示例#1
0
        public static IPagedList <TEntity> ToPagedList <TEntity>(this IEnumerable <TEntity> list, int page, int pageSize, long total) where TEntity : class, new()
        {
            PagedListResult <TEntity> result = new PagedListResult <TEntity>(page, pageSize, total);

            result.AddRange(list);
            return(result);
        }
示例#2
0
        public static IPagedList <TEntity> ToPagedList <TEntity, TKey>(this SqlExpression <TEntity> expression, IDbConnection connection, int page, int pageSize)
            where TEntity : CopterBaseEntity <TKey>, new()
            where TKey : struct
        {
            long total = connection.Count(expression);
            PagedListResult <TEntity> result = new PagedListResult <TEntity>(page, pageSize, total);

            result.AddRange(connection.Select(expression.Skip((page - 1) * pageSize).Take(pageSize)));
            return(result);
        }