BulkInsert sample

Sep 7, 2015 at 11:48 PM

is there any example of use for BulkInsert method?

Sep 8, 2015 at 1:53 PM
First, let's be clear on what BulkInsert does. It's purely a convenience method that is a simple extension method. It takes in an array of items, iterates across them and calls Insert for each item. It's not equivalent to anything like SQL Server's BCP, and doesn't give any performance gains.

Usage is really simple. Let's say we have an Entity called Thing. You can insert a set of them like this:
IEnumerable<Thing> things = GetThings();
Functionally, this is identical to doing this:
IEnumerable<Thing> things = GetThings();
foreach(var thing in things)
Sep 9, 2015 at 3:25 PM
Thanks ctacke,

What I was looking for was performance gains, it became really slow inserting many records.

I found the ORM_CreateProxy approach and now it flies!
Sep 9, 2015 at 6:51 PM
Edited Sep 9, 2015 at 6:52 PM
For the record, the key point to improve speed, besides ORM_CreateProxy, is the UseCommandCache property in DataStore:
  store.ConnectionBehavior = ConnectionBehavior.Persistent;
  store.UseCommandCache = true;