An improved version of SqlBulkCopy.
// Easy to use
bulk.DestinationTableName = "Customers";
bulk.BulkMerge(customers);
// Easy to customize
bulk.DestinationTableName = "Customers";
bulk.BatchSize = 100;
bulk.AutoMapOutputIdentity = true;
bulk.BulkMerge(customers);
- Try it (DataTable): https://dotnetfiddle.net/2B7QpT
- Try it (Entity): https://dotnetfiddle.net/istUUT