Linked Questions
136 questions linked to/from Fastest Way of Inserting in Entity Framework
117 votes
11 answers
115k views
Improving bulk insert performance in Entity framework [duplicate]
I want to insert 20000 records in a table by entity framework and it takes about 2 min. Is there any way other than using SP to improve its performance. This is my code: foreach (Employees item in ...
93 votes
6 answers
48k views
When should I call SaveChanges() when creating 1000's of Entity Framework objects? (like during an import) [duplicate]
I am running an import that will have 1000's of records on each run. Just looking for some confirmation on my assumptions: Which of these makes the most sense: Run SaveChanges() every AddToClassName(...
1 vote
2 answers
3k views
Writing to large number of records take too much time using Entity Framework [duplicate]
I'm working on a project that just inserts relatively large number of records (250K records, just 2 columns) using Entity Framework code-first.. But it takes too much time to write all the records to ...
2 votes
2 answers
1k views
Entity framework - how long should it take to add 75k rows? [duplicate]
I have a following setup: Table1 - 150k rows currently, need to add another 25k rows, Table2 - 300k rows, need to add another 50k. I add rows in a loop, like that (EF code first): using (var context =...
0 votes
1 answer
2k views
Entity Framework Updating 100K Records [duplicate]
I am using EF6 with SQLCE database with few tables which have more than 200K records each. I am trying to update records in one of those tables but unfortunately, the updating process is very slow ...
1 vote
2 answers
1k views
Alternative to bulk update with Entity Framework [duplicate]
I have a table with 100,000+ records. Customer has asked that we encrypt the username field, copy the encrypted value to a new field, and clear the original username field. The encryption can only be ...
0 votes
1 answer
2k views
Why is this Entity Framework database update so slow? [duplicate]
I have written a class to upload a very large set of data into a database. The foreach loop seems to be slow, taking around 16ms per loop iteration. In what ways could I increase the speed of this ...
0 votes
1 answer
479 views
Frequent saving database efficient with millions of entries? [duplicate]
I am trying to insert a ton of data into a SQL server database and my question is, how often i should save when millions of entries are going to be inserted there. Is it efficient to save it after e.g....
0 votes
1 answer
953 views
Entity Framework poor performance on SaveChanges in large batch job [duplicate]
We have a requirement to read a load of xml files, run validation on them, transform them into entities and stores them in the database. This was being done using a repository wrapping Entity ...
1 vote
1 answer
195 views
Inserting bulk records. Perhaps with SQL [duplicate]
I have a button with a list of users in the table ButtonUsers. A parent Button is updated with the list of users, and all other Buttons' UserList should be updated. This isn't the case every time, ...
0 votes
1 answer
153 views
Entity Framework much slower than ssis [duplicate]
I am trying to take all the ids from a table of 1.3 million rows and insert them into another table in another database using Entity Framework. When I do this with SSIS, it is done in under 5 minutes, ...
0 votes
0 answers
24 views
How can I improve the performance of adding many entities to DbContext.Set<T>().Attach(...) in EF6 [duplicate]
I am using EF6 in a project. Because of the speed limitations for adding many (i.e. 10,000+) entities via EF6 I have resorted to doing the database additions outside of EF6. The code that does the ...
182 votes
7 answers
174k views
How do I clear tracked entities in entity framework
I am running some correction code that runs over a big pile of entities, as it progress its speed decreases, that is because the number of tracked entities in the context increase with each iteration, ...
96 votes
13 answers
143k views
Entity Framework is Too Slow. What are my options? [closed]
I have followed the "Don't Optimize Prematurely" mantra and coded up my WCF Service using Entity Framework. However, I profiled the performance and Entity Framework is too slow. (My app processes 2 ...
67 votes
7 answers
55k views
TransactionScope Prematurely Completed
I have a block of code that runs within a TransactionScope and within this block of code I make several calls to the DB. Selects, Updates, Creates, and Deletes, the whole gamut. When I execute my ...