-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
ASP.NET Core 9 Web API Cookbook
By :
In this recipe, we will learn how to add paging to our GraphQL API using Hot Chocolate’s built-in paging capabilities. We will implement cursor-based pagination using Hot Chocolate’s [UsePaging] attribute. The [UsePaging] attribute works well with Entity Framework’s IQueryable<T> to directly work with the database context without having to load extra results into memory. IQueryable<T> is so efficient as it enables deferred execution and query composition.
The starter project can be found here: https://github.com/PacktPublishing/ASP.NET-9-Web-API-Cookbook/tree/main/start/chapter08/Pagination/.
Note: This recipe uses the HotChocolate.Data package, which we installed in the previous recipe and is included in the starter project. This package provides the filtering and sorting capabilities we’ll use alongside pagination.