entity.saveChanges within the foreach because it is a large list, around 3k records and it was taking around 10-15 minutessolution :
Entityframework 6.xx
reference
https://stackoverflow.com/questions/21272763/entity-framework-performance-issue-savechanges-is-very-slow
using (var context = new CustomerContext())
{
context.Configuration.AutoDetectChangesEnabled = false;
// A loop to add all your new entities
context.SaveChanges();
}
Entityframework core
make this line as false, remember it has its own effect if your working connected entity
it worked for me because i working in disconnected entities model
db.ChangeTracker.AutoDetectChangesEnabled = false;
No comments:
Post a Comment