using System.Collections.Generic;
using System.Data.Entity;
public static void Main()
using (var context = new EntityContext())
var list = context.Customers.ToList();
context.Customers.Add(new Customer() { Code = "Customer_C" });
context.Customers.Add(new Customer() { Code = "Customer_D" });
list.Single(x => x.Code == "Customer_A").Code = "Customer_A_Modified";
context.Customers.Remove(list.Single(x => x.Code == "Customer_B"));
var resultInfo = new Z.BulkOperations.ResultInfo();
context.BulkSaveChanges(options => {
options.UseRowsAffected = true;
options.ResultInfo = resultInfo;
FiddleHelper.Dump(resultInfo);
public static void GenerateCustomers()
using (var context = new EntityContext())
context.Customers.Add(new Customer() { Code = "Customer_A" });
context.Customers.Add(new Customer() { Code = "Customer_B" });
context.BatchSaveChanges();
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
public DbSet<Customer> Customers { get; set; }
public int CustomerID { get; set; }
public string Code { get; set; }