Dynamic Order (SQL ORDERBY) in LINQ CompiledQuery
问题 how can I create a dynamic ORDERBY in my LINQ CompiledQuery (e.g. supply Order Field and Direction as parameters for the compiled query)? 回答1: I think I found it: Check out this link. It will point you to the VS2008 code samples which contains a Dynamic Linq Query Library which contains the extension method below. This will allow you to go: Object.OrderBy("ColumnName"); Here is the extension methods, but you may want the whole library. public static IQueryable<T> OrderBy<T>(this IQueryable<T>