0

So for some background I'm inserting/updating large numbers > 100,000s of objects into a table. The table has a one to one relation with another table, as well as having a a many to one relation ship with another, which all obviously need to be preserved. Something of note is that most of the need is for UPDATING, generally we are adding information the first time we find it, and then continuously update it based on changes. I've been trying to do my due diligence before asking, so I've looked at many other sources on the topic, and have proceeded to disable things like change tracking, batching adds then using a new context, etc, but it's still not really where I'd like for (or think) it to be.

So with that said I wanted to change to using Bulk Insert, and was wondering if there are any good extension libraries that are generally accepted/reliable/etc, or can anyone give any advice on how to proceed/recommend resources on implementing BulkInsert from entity framework objects. Some concerns I have is updating as opposed to inserting and whether that is something BulkInsert can support, as well as retaining relations and what Bulk Insert does in that regard.

As a final note I saw a recommendation somewhere to bulk insert all of the entries to a temp table, then use that to merge, and then drop the temp table. That seemed promising as it would handle both update and insert.

magicandre1981
  • 27,895
  • 5
  • 86
  • 127
Logan McManus
  • 67
  • 1
  • 9

1 Answers1

0

the solutions is use many times the same context each cycle, and save at the same time.

Visit this post, It helped me a lot Fastest Way inserting entity

I hope it helps you