using System.Collections.Generic;
using System.Data.Entity;
using System.Linq.Dynamic.Core;
public static void Main()
using (var context = new EntityContext())
var list = context.Customers
.Select("new (Name, CompanyName as Company, Phone)").AsEnumerable();
foreach (var val in list)
public static void GenerateData()
List<Customer> list = new List<Customer>();
Name = "Terri Lee Duffy",
Name = "Michael Sullivan",
Name = "Rebecca Bradley",
using (var context = new EntityContext())
context.Customers.AddRange(list);
context.BulkSaveChanges();
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 string CompanyName { get; set; }
public string City { get; set; }
public string Phone { get; set; }