EF / SQL Server writes too slow? - Thu, May 11, 2017
I was using Entity Framework Core on a project which required a large amount of writes (inserts and updates) to a SQL Server 2017 database. The operation was extremely slow, in the order of several hours/half a day. I figured out that it was due to the EF overhead for tracking changes. Setting the following boolean to false saves a lot of time, if you have to do a lot of writes:
using (var db = new MyContext())
{
db.ChangeTracker.AutoDetectChangesEnabled = false;
//Do Stuff
db.ChangeTracker.AutoDetectChangesEnabled = true;
}