mrahhal / MR.AspNetCore.Pagination

Pagination for ASP.NET Core.
MIT License
62 stars 3 forks source link

The service should be able to take in pagination params in the method as an alternative to reading them from the query #3

Closed mrahhal closed 2 years ago

mrahhal commented 2 years ago

All methods should also have overloads that accept the pagination query model directly as an argument, as opposed to parsing it from the request query.

// Won't parse anything from the request's query.
var usersPaginationResult = await _paginationService.KeysetPaginateAsync(
    _dbContext.Users,
    b => b.Descending(x => x.Created),
    async id => await _dbContext.Users.FindAsync(int.Parse(id)),
    queryModel: new KeysetQueryModel
    {
        // Get the first page, with 10 items.
        First = true,
        Size = 10,
    });
miketof commented 2 years ago

Definitely agree with that!