Skip to content

Instantly share code, notes, and snippets.

// Single Key
ctx.BulkUpdate(customers, operation => operation.ColumnPrimaryKeyExpression =
customer => customer.Code);
// Surrogate Key (with anonymous type)
ctx.BulkUpdate(customers, operation => operation.ColumnPrimaryKeyExpression =
customer => new { customer.Code1, customer.Code2, customer.Code3 });
// DON'T add the key if auto-generated
ctx.BulkInsert(customers, operation => operation.ColumnInputExpression =
customer => new {customer.Name, customer.Email});
// ALWAYS add the key
ctx.BulkUpdate(customers, operation => operation.ColumnInputExpression =
customer => new { customer.ID, customer.Name, customer.Email });
// ALWAYS add the key
ctx.BulkMerge(customers, operation => operation.ColumnInputExpression =
public Benchmark()
{
// BENCHMARK using Stopwatch
var clock1 = new Stopwatch();
var clock2 = new Stopwatch();
var nbRecord = 1000;
var nbTry = 5;
var list = GenerateData(nbRecord);