I cannot find any examples on how to do a Bulk/batch insert using Linq to Entities. Do you guys know how to do a Bulk Insert?
+1
A:
- You can't do any kind of insert in LINQ-to-anything. LINQ doesn't do inserts.
- The EF doesn't do bulk inserts per se.
- You can however insert multiple records in a single transaction by only calling SaveChanges once.
It would be easier to help you with your problem if you explained what you're trying to do in much more detail.
Craig Stuntz
2009-10-22 18:45:44
+1
A:
Sometimes you simply have to mix models. Perhaps use SqlBulkCopy
for this part of your repository (since this plugs directly into the bulk-copy API), and Entity Framework for some of the rest. And if necessary, a bit of direct ADO.NET. Ultimately the goal is to get the job done.
Marc Gravell
2009-10-22 21:19:19