How to do a Bulk Insert -- Linq to Entities

Luke101 picture Luke101 · Oct 22, 2009 · Viewed 36.4k times · Source

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?

Answer

Marc Gravell picture Marc Gravell · Oct 22, 2009

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.