danc
danc
CC#
Created by greg/Ryhor on 9/10/2024 in #help
Not sure what Senior Dev expect me to do
following your own pseudo code example, making it generic should be very simple:
class PaginatedHandler<T> : IRequestHandler<PaginatedResultsDto<T>>

query = _repo.SelectItems

query.AddSearch

totalCount = query.Count()

query.AddSort()

query.skip().take()

return totalCount, page, items etc.
class PaginatedHandler<T> : IRequestHandler<PaginatedResultsDto<T>>

query = _repo.SelectItems

query.AddSearch

totalCount = query.Count()

query.AddSort()

query.skip().take()

return totalCount, page, items etc.
You could then create paginated handlers for any type by
var handler = new PaginatedHandler<ItemDto>(_repo, ...);
var handler = new PaginatedHandler<ItemDto>(_repo, ...);
17 replies
CC#
Created by greg/Ryhor on 9/10/2024 in #help
Not sure what Senior Dev expect me to do
If there is an expectation that more are coming, I would make it generic too
17 replies