I have a simple console app
written in C#
with VS.NET 2012
. I'm using a simple database with Entity Framework 5
(model first). I have two tables, Customer, and Email. Every email record has a reference to a customer record.
I create the customer and email object, save them to the collection in the EF
context, and after 1000 records have been created, I call save changes on the context. The batches of 1000 become increasingly slow, starting out with 1 minute for 1000, and then by the 9000th record, the batches of 1000 take 4 minutes to complete.
I am reading the data out of a CSV
file one line at a time, doing a simple split on each line, and then constructing the simple objects.
My question is whether this is EF5
, or if I'm missing an index
on the database? I'm doing no other pre-processing. I'm using SQL Server 1012
.