public static IQueryable <T> Page <T>(this IOrderedQueryable <T> obj, int page, int pageSize, out int objectsCount) { objectsCount = System.Linq.Queryable.Count <T>(obj); if (page > 1 && (page - 1) * pageSize >= objectsCount) { page = (objectsCount - 1) / pageSize + 1; } return(PagerableOrderableHelper.Page <T>(obj, page, pageSize)); }
public static IOrderedQueryable <T> OrderBy <T>(this IQueryable <T> source, string propertyName, bool asc) { return(PagerableOrderableHelper.OrderingHelper <T>(source, propertyName, !asc, false)); }
public static IOrderedQueryable <T> OrderByDescending <T>(this IQueryable <T> source, string propertyName) { return(PagerableOrderableHelper.OrderingHelper <T>(source, propertyName, true, false)); }
public static IQueryable <TSource> Take <TSource>(this IQueryable <TSource> source, Expression <Func <int> > countAccessor) { return(PagerableOrderableHelper.Parameterize <TSource, int>(PagerableOrderableHelper.TakeMethodInfo, source, countAccessor)); }
public static IOrderedQueryable <T> ThenBy <T>(this IOrderedQueryable <T> source, string propertyName) { return(PagerableOrderableHelper.OrderingHelper <T>((IQueryable <T>)source, propertyName, false, true)); }