Exemplo n.º 1
0
 public PagingRequest(PagingRequest request)
 {
     if (request == null)
     {
         return;
     }
     Offset = request.Offset;
     Limit  = request.Limit;
 }
Exemplo n.º 2
0
        public static async Task <Paging <TP> > CreateAsync <TP>(
            IQueryable <TP> query,
            PagingRequest request,
            CancellationToken cancellationToken = default)
        {
            var count = await query.CountAsync(cancellationToken);

            var data = await query
                       .Skip(request.Offset)
                       .Take(request.Limit)
                       .ToArrayAsync(cancellationToken);

            return(new Paging <TP>(data, count));
        }