using System.Collections.Generic;
using System.Data.Entity;
using System.Linq.Dynamic.Core;
public static void Main()
var context = new EntityContext();
var query1 = context.Customers
.Include(c => c.Location)
.Where("c => c.CompanyName == \"ABC\" && c.Location.Name == \"test\"");
query1.Expression.ToString().Dump();
var config = new ParsingConfig
RenameParameterExpression = true
var query2 = context.Customers
.Include(c => c.Location)
.Where(config, "c => c.CompanyName == \"ABC\" && c.Location.Name == \"test\"");
query2.Expression.ToString().Dump();
public static void GenerateData()
var list = new List<Customer>();
Name = "Terri Lee Duffy",
Location = new Location() { Name = "test" },
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 DbSet<Location> Locations { 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; }
public Location Location { get; set; }
public int LocationID { get; set; }
public string Name { get; set; }