Created
August 16, 2012 14:05
-
-
Save smiler/3370341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// xxx => | |
try { | |
var x = Expression.Parameter( source.ElementType, "x" ); | |
// => xxx | |
var selector = Expression.Lambda( Expression.PropertyOrField( x, co.GetOrderColumn() ), x ); | |
return source.Provider.CreateQuery( | |
Expression.Call( typeof( Queryable ), co.IsDescending() ? "OrderByDescending" : "OrderBy", new Type[] { source.ElementType, selector.Body.Type }, | |
source.Expression, selector | |
) ) as IQueryable<T>; | |
} catch { | |
return source; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment