greg/Ryhor
greg/Ryhor
CC#
Created by greg/Ryhor on 9/10/2024 in #help
Not sure what Senior Dev expect me to do
Hello, I'm moving my post to this forum so it will be more visible. I just finished in my job simple endpoint that returns paginated result, we use clean arch with mediatr - easy. My handler looks something like (pseudo code)
class GetItemsHandler : IRequestHanlder<PaginatedResultsDto<ItemDto>>

query = _repo.SelectItems

query.AddSearch //just add where for filer over one field

totalCount = query.Count();

query.AddSort() //parameters were parsed from http query params


query.skip().take()

return totalCount, page, items etc.
class GetItemsHandler : IRequestHanlder<PaginatedResultsDto<ItemDto>>

query = _repo.SelectItems

query.AddSearch //just add where for filer over one field

totalCount = query.Count();

query.AddSort() //parameters were parsed from http query params


query.skip().take()

return totalCount, page, items etc.
... so not much logic into that, And then Senior Dev join my Pull Request, marked whole file with comment 'I think that paginated handlers with search and sort can be made in generic way' Tbh I havent see something like that ever, especially if that used clean arch with Mediatr. So I am now in seek and wonder how to do that and I question myself if its even good practice.. Could I use your wisdom with maybe some example from web?
17 replies