Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzzprojects/db152af3f093e799200e2ee39bb14bae to your computer and use it in GitHub Desktop.
Save zzzprojects/db152af3f093e799200e2ee39bb14bae to your computer and use it in GitHub Desktop.
// 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 });
ctx.BulkUpdate(customers, operation =>
{
operation.AllowDuplicateKeys = true;
operation.ColumnPrimaryKeyExpression = customer => customer.Code;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment