using System.Collections.Generic;
using System.Data.Entity;
using System.Linq.Dynamic.Core;
public static void Main()
var context = new EntityContext();
var results = context.Orders.Select( "new (Amount, Price, CustomerName, Month)" ).AsQueryable();
foreach(var order in results)
Console.WriteLine(order.Amount.ToString());
public static void GenerateData()
var orders = new List<Order>
new Order { Amount = 5, Price = 3, CustomerName = "Raja", Month = 4 },
new Order { Amount = 10, Price = 8, CustomerName = "Raja", Month = 4 }
using (var context = new EntityContext())
context.Orders.AddRange(orders);
context.BulkSaveChanges();
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
public DbSet<Order> Orders { get; set; }
public int Id { get; set; }
public int Amount { get; set; }
public double Price { get; set; }
public string CustomerName { get; set; }
public int Month { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public string CompanyName { get; set; }
public string City { get; set; }
public string Phone { get; set; }