using System.Collections.Generic;
using System.Data.Entity;
public static void Main()
using (var context = new EntityContext())
var list = context.Customers.ToList();
list.ForEach(x => x.Name = "NewName");
FiddleHelper.WriteTable("1 - Before", context.Customers.AsNoTracking().ToList());
context.BulkMerge(list, options => {
options.PostConfiguration = bulk => {
bulk.ColumnMappings.Single(x => x.SourceName == "Description").FormulaUpdate = "DestinationTable.Name + ';' + StagingTable.Description";
FiddleHelper.WriteTable("1 - After", context.Customers.AsNoTracking().ToList());
public static void GenerateData()
using (var context = new EntityContext())
context.Customers.Add(new Customer() { Name ="Customer_A", Description = "Description" });
context.Customers.Add(new Customer() { Name ="Customer_B", Description = "Description"});
context.BulkSaveChanges();
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
public DbSet<Customer> Customers { get; set; }
public int CustomerID { get; set; }
public string Name { get; set; }
public string Description { get; set; }