/// <summary> /// 转换为可分页集合(注:需要对查询接口进行排序操作,否则 LINQ 会抛出未排序异常)。 /// </summary> /// <typeparam name="TEntity">指定的实体类型。</typeparam> /// <param name="orderedQuery">给定的 <see cref="IOrderedQueryable{TEntity}"/>。</param> /// <param name="skip">给定的跳过条数。</param> /// <param name="take">给定的获取条数。</param> /// <returns>返回 <see cref="IPageable{TEntity}"/>。</returns> public static IPageable <TEntity> AsPagingBySkip <TEntity>(this IOrderedQueryable <TEntity> orderedQuery, int skip, int take) where TEntity : class => orderedQuery.AsPaging(paging => paging.ComputeBySkip(skip, take));
/// <summary> /// 转换为可分页集合(注:需要对查询接口进行排序操作,否则 LINQ 会抛出未排序异常)。 /// </summary> /// <typeparam name="TEntity">指定的实体类型。</typeparam> /// <param name="orderedQuery">给定的 <see cref="IOrderedQueryable{TEntity}"/>。</param> /// <param name="index">给定的页索引。</param> /// <param name="size">给定的页大小。</param> /// <returns>返回 <see cref="IPageable{TEntity}"/>。</returns> public static IPageable <TEntity> AsPagingByIndex <TEntity>(this IOrderedQueryable <TEntity> orderedQuery, int index, int size) where TEntity : class => orderedQuery.AsPaging(paging => paging.ComputeByIndex(index, size));