Although it's a bit late, and the answers and comments posted above are very useful, I just leave it here and hope it will be useful to people who have the same problem as me and come to this post for answers. This post still holds a high place on Google (at the time this answer was posted) if you are looking for a way to bulk write entries using the Entity Framework.
I had a similar problem using Entity Framework and Code First in an MVC 5 application. I had a user who submitted a form that called tens of thousands of records to insert into a table. The user had to wait more than two and a half minutes, while 60,000 records were inserted into it.
After much searching, I came across BulkInsert-EF6 , which is also available as a NuGet package. Reset OP code:
var tempItemList = new List<MyStuff>(); foreach(var item in listOfItemsToBeAdded) {
My code went from 2 minutes to <1 second for 60,000 entries.
source share