I need to insert some objects (about 4 million) into the database using C # and EF (using .NET 3.5). My method that adds objects is in: for
private DBModelContainer AddToContext(DBModelContainer db, tblMyTable item, int count) { db.AddTottblMyTable (item); if ((count % 10000== 0) || (count == this.toGenerate)) { try { db.SaveChanges(); } catch (Exception e) { Console.WriteLine(e.StackTrace); } } return db; }
How to separate added objects (such as tblMyTable) from a context object? I do not need them for later use, and when more than 300,000 objects are added, the runtime between saving db (db.SaveChanges ()) increases significantly.
Hi
c # entity-framework database-performance
Buda gavril
source share