using System.Collections.Generic;
using System.Data.Entity;
using System.Linq.Expressions;
public static void Main()
using (var context = new EntityContext())
var query = context.Customers.OrderByDescendingDynamic(x => "x.Name");
query = query.ThenByDescendingDynamic(x => "x.Description");
FiddleHelper.WriteTable("Customers",query.ToList());
public static void GenerateData()
using (var context = new EntityContext())
context.Customers.Add(new Customer() { Name = "Customer_A", Description = "ZZZ Projects"});
context.Customers.Add(new Customer() { Name = "Customer_A", Description = "Description"});
context.Customers.Add(new Customer() { Name = "Customer_B", Description = "Description"});
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 Description { get; set; }
public string Method { get; set; }
public string Field { get; set; }
public string Operation { get; set; }
public string Value { get; set; }
public string Expression { get; set; }