public static IQueryable <TSource> OrderBy <TSource>(this IQueryable <TSource> query, string key, bool ascending = true) { if (string.IsNullOrWhiteSpace(key)) { return(query); } var lambda = (dynamic)CreateExpression(typeof(TSource), key); return(ascending ? Queryable.OrderBy(query, lambda) : Queryable.OrderByDescending(query, lambda)); }
public static IOrderedQueryable <T> OrderBy(IQueryable <T> queryable, string propertyName, bool desc) { dynamic keySelector = GetLambdaExpression(propertyName); return(desc ? Queryable.OrderByDescending(queryable, keySelector) : Queryable.OrderBy(queryable, keySelector)); }
public static IQueryable <T> OrderBy(IQueryable <T> queryable, string propertyName) { dynamic keySelector = GetLambdaExpression(propertyName); return(Queryable.OrderBy(queryable, keySelector)); }
public virtual IOrderedQueryable <TSource> OrderBy <TSource, TKey>(IQueryable <TSource> source, Expression <Func <TSource, TKey> > keySelector, IComparer <TKey> comparer) { return(Queryable.OrderBy <TSource, TKey>(source, keySelector, comparer)); }
/// <inheritdoc cref="Queryable.OrderBy{TSource, TKey}(IQueryable{TSource}, Expression{Func{TSource, TKey}}, IComparer{TKey})" /> public static IOrderedQueryableAndAsyncQueryable <TSource> OrderBy <TSource, TKey>(this IQueryableAndAsyncQueryable <TSource> source, Expression <Func <TSource, TKey> > keySelector, IComparer <TKey> comparer) { return((IOrderedQueryableAndAsyncQueryable <TSource>)Queryable.OrderBy <TSource, TKey>(source, keySelector, comparer)); }
public static IOrderedQueryable <TSource> OrderBy(IQueryable <TSource> source, string propertyName) => Queryable.OrderBy(source, (dynamic)CreateLambdaExpression(propertyName));
public static IOrderedAsyncQueryable <TSource> OrderBy <TSource, TKey>(this IAsyncQueryable <TSource> source, Expression <Func <TSource, TKey> > keySelector) { return((IOrderedAsyncQueryable <TSource>)Queryable.OrderBy(source, keySelector)); }