How do you implement paging on API requests?
Basically title.
Do you implement it by yourself or do you use any nuget?
7 Replies
It's super easy to just implement yourself, so using a nuget would just be a waste
's it
Plug it into your EF query and you're done
I've seen a snippet/nuget around that added some
PageableResponse<T>
thing that added information such as total count, current page index etc so the client can make an informed request. Can't remember if it had a name thou. Its basicly what ZZZ wrote but with a few helper queriesSorry, but what use does
Paginate<T>
have here?Ohhh.... thanks
So all service methods shoudl be something like this, or is it any easier/better way?
That'll give you the items for that page. If you want to provide page count etc you'll need a wrapper