I don\'t know if it\'s an Entity Framework\'s desing choice or a wrong approach on my behalf, but whenever I try to AddRange entities to a DbSet I can\'t seem to get the aut
In Entity Framework Core using Code First, I got this to work by doing two things:
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] decorator to the Entity's Primary Key, like Yashveer Singh's answer statedAfter performing those two steps, I didn't need to convert IEnums to Arrays. I was simply able to run:
_dbContext.Entities.AddRange(entities);
await _dbContext.SaveChangesAsync();