Easy Pagination for Entity Framework in 3 steps #39
Replies: 2 comments 1 reply
-
|
Thanks for sharing this. It's nice to see a detailed implementation with discussion around how/why choices were made. Just curious, have your see this? https://github.com/dncuug/X.PagedList |
Beta Was this translation helpful? Give feedback.
-
|
Every article using skip/take for pagination should contain big red disclaimer: T H I S W I L L G E T S L O W A N D Y O U ‘ L L G E T H U R T :-) Why? Such code will work fast only while total number of suitable items in DB is not very big. Which is defcon-1 level threat, as problems will arise only when your app becomes used on daily basis for a while. Suppose user will eventually get to a point where they have, for example, 1000 items and you need to show last 20.
So one should Some quickstarter links from .NET Data team: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Easy Pagination for Entity Framework in 3 steps
Pagination is the process of dividing a set into discrete pages. In the context of Entity Framework, that means we are only getting a certain amount of entries from the database.
And we will implement a very easy solution to make that happen in 3 steps. The result will look like this:
var pagedList = DbContext.BlogPosts.ToPagedList(page: 1, pageSize: 5);
https://steven-giesel.com/blogPost/09285b33-79e6-4879-95e0-35aeae5fbcc6
Beta Was this translation helpful? Give feedback.
All reactions