using System.Data.Entity;
using System.Collections.Generic;
using System.Diagnostics;
public static void Main()
var context = new EntityContext();
for(int i = 0; i <= 2000; i++)
if (i != 0 && i%batchSize == 0)
context = new EntityContext();
var customer = new Customer();
customer.Name ="Customer_" + i;
context.Customers.Add(customer);
Console.WriteLine(context.Customers.Count());
FiddleHelper.WriteTable(context.Customers.Take(5).ToList());
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; }