using System.Data.Entity;
using System.Collections.Generic;
public static void Main()
using (var context = new EntityContext())
context.BulkInsert(Data());
FiddleHelper.WriteTable(context.Customers.ToList());
using (var context = new EntityContext())
var list = context.Customers.ToList();
foreach(var customer in list)
list.Add(new Customer(){ Name = "New Customer 1", IsActive = true });
list.Add(new Customer(){ Name = "New Customer 2", IsActive = true });
FiddleHelper.WriteTable(context.Customers.ToList());
public static List<Customer> Data()
List<Customer> list = new List<Customer>();
for(int i = 0; i < 3; i++)
list.Add(new Customer() { Name ="Customer_" + i, IsActive = isActive });
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 bool IsActive { get; set; }