DotNetCore Entity Framework | Generic Pagination

Viewed 6568

I was looking for a way to do generic pagination with Entity Framework in Dotnet Core 1.1.

I found this guide on MSDN: https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application

But this was not generic and did not allow me to reuse code.

Included is the answer I used if anyone is looking into this, I thought it would be nice to share.

It uses custom Attributes on models, and returns a pagination model.

1 Answers
Related