using System.Data.Entity;
using System.Collections.Generic;
public static void Main()
var customers1 = GenerateCustomers(0, 5);
var customers2 = GenerateCustomers(5, 5);
using (var context = new EntityContext())
FiddleHelper.WriteTable("1 - Customers Before", context.Customers);
context.BulkInsert(customers1);
context.BulkInsert(customers2, options => options.BatchSize = 100);
FiddleHelper.WriteTable("2 - Customers After", context.Customers);
public static List<Customer> GenerateCustomers(int start, int count)
List<Customer> list = new List<Customer>();
for(int i = start; i < start + count; i++)
list.Add(new Customer() { Name ="Customer_" + i});
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; }