using System.Collections.Generic;
using System.Diagnostics;
using System.Data.Entity;
public static void Main()
var context = new EntityContext();
context.Customers.Add(new Customer());
var clock = new Stopwatch();
context.Customers.Add(new Customer());
Console.WriteLine("Time to add 1 entities when the context contains 1 entities: " + clock.ElapsedMilliseconds + "ms");
var list = new List<Customer>();
for(int i = 0; i < 10000; i++)
list.Add(new Customer());
context.Customers.AddRange(list);
var clock = new Stopwatch();
context.Customers.Add(new Customer());
Console.WriteLine("Time to add 1 entities when the context contains 10002 entities: " + clock.ElapsedMilliseconds + "ms");
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
public DbSet<Customer> Customers { get; set; }
public DbSet<Invoice> Invoices { get; set; }
public int CustomerID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Boolean IsActive { get; set; }
public List<Invoice> Invoices { get; set; }
public int ID { get;set; }
public string Code { get; set; }