I have a linq query of objects of a known type and I need to sort it based on a property of the object. The problem is I only know the property name at runtime and as a string.
ex.
IQueryable<Thing> thing = from t in ctx.Things select t;
t.OrderBy(t => t.Name); // This would work if I knew the property at compile time...
t.OrderBy("Name asc"); // But this is what I really need! and it doesn't work.
Is there a way to do this for LINQ to Entities? I'm using entity framework 4.1