Reusable PagedResults type for Entity Framework Core

Use this PagedResults type and query extension which can be used for Entity Framework Core pagination across different entities.

You can learn more about using PagedResults in Entity Framework Core, or watch the video:

Download the code example

You'll need to fill out the code example form. We will send you an email where you can download the code example.

Software

This is the software that will need to be installed onto your machine.

Import the database

This application integrates with a SQL Server database. Inside the Database folder, there is RoundTheCode_PagedResultsExample.bacpac and RoundTheCode_PagedResultsExample.bak. Use either of these database backups to import the database to your local SQL Server database server.

The application

Inside src/Api/appsettings.Development.json, find ConnectionStrings.PagedResultsExampleDbContext and point the connection string to your imported database.

Open up RoundTheCode.PagedResultsExample.slnx, and run the application. The Swagger documentation will load at https://localhost:56001/swagger with this endpoint:

  • /api/products/manual (GET) - Uses the PagedResults class to display the paginated records, page, page size, the records count and the page count