示例#1
0
 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));
 }
示例#2
0
 public static IOrderedQueryable <T> OrderBy <T>(this IQueryable <T> source, string propertyName, bool asc)
 {
     return(PagerableOrderableHelper.OrderingHelper <T>(source, propertyName, !asc, false));
 }
示例#3
0
 public static IOrderedQueryable <T> OrderByDescending <T>(this IQueryable <T> source, string propertyName)
 {
     return(PagerableOrderableHelper.OrderingHelper <T>(source, propertyName, true, false));
 }
示例#4
0
 public static IQueryable <TSource> Take <TSource>(this IQueryable <TSource> source, Expression <Func <int> > countAccessor)
 {
     return(PagerableOrderableHelper.Parameterize <TSource, int>(PagerableOrderableHelper.TakeMethodInfo, source, countAccessor));
 }
示例#5
0
 public static IOrderedQueryable <T> ThenBy <T>(this IOrderedQueryable <T> source, string propertyName)
 {
     return(PagerableOrderableHelper.OrderingHelper <T>((IQueryable <T>)source, propertyName, false, true));
 }