public PagingDataSource(IList <T> dataSource, PagingQuery pagingQuery, int recordCount = 0) :
     this(dataSource, pagingQuery.Page, pagingQuery.PageSize, recordCount)
 {
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="queryableSource"></param>
        /// <param name="pagingQuery"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public static PagingDataSource <T> QueryPagingDataSource <T>(this IQueryable <T> queryableSource, PagingQuery pagingQuery, int recordCount = 0) where T : class
        {
            if (recordCount == 0 && pagingQuery.IsGetRecordCount)
            {
                recordCount = queryableSource.Count();
            }

            return
                (ToPagingDataSource(queryableSource.Skip(pagingQuery.GetSkipCount()).Take(pagingQuery.PageSize).ToList(),
                                    pagingQuery, recordCount));
        }
Exemplo n.º 3
0
 public static int GetSkipCount(this PagingQuery query)
 {
     return((query.Page - 1) * query.PageSize);
 }
Exemplo n.º 4
0
 /// <summary>
 /// list 转换为 PagingDataSource
 /// </summary>
 /// <returns></returns>
 public static PagingDataSource <T> ToPagingDataSource <T>(this IList <T> dataSource, PagingQuery pagingQuery, int recordCount = 0) where T : class
 {
     return(new PagingDataSource <T>(dataSource, pagingQuery.Page, pagingQuery.PageSize, recordCount));
 }