2

I'm on a project using Entity Framework 5 and SQL Server 2012. We have a need to insert a large number of rows at once (order of 100k entities). Basically we have a physics program that outputs a large amount of binary data that we then need to process and pull into a SQL 2012 DB. We're using EF5 as the ORM in other places in the application, but I'm doubtful of it's ability to handle this kind of insert in a timely fashion.

We're using a database-first approach where the POCOs generated from the model are passed around throughout the code-base as the primary DTOs.

I would also add that this insert involves multiple tables with foreign key relationships. Is this an issue with the various bulk insert methods out there.

Does anyone have any similar experience with this or a recommended approach?

Brian Triplett
  • 3,462
  • 6
  • 35
  • 61
  • @TI - The the question you mention is similar. I've added some edits to be more clear about how this differs. – Brian Triplett Apr 02 '13 at 14:29
  • EF is not intended for bulk operations. Each insert will be a separate hit to the database. Use SSIS/Bulk Copy for this amount of data import. – Jim Wooley Apr 02 '13 at 17:18

1 Answers1

2

I would look into the Bulk Insert that is available. Here is a link to some information on it: Bulk Insert. I would also look at SQL Compact Bulk, which was used Here . Another link where a user submitted his code Stack Link.

Community
  • 1
  • 1
CodeMonkey
  • 1,087
  • 2
  • 15
  • 24