What's the best practice to do “stable paging” in OData?

谁说胖子不能爱 提交于 2019-12-12 14:14:00

问题


In the comment of this post (Problem with WCF Data Service (OData), SetEntitySetPageSize and custom operations), it mentioned “OData stable paging”.

I am quite new to OData, and trying to get stable paging in OData query.

By "stable paging", I mean there is an OData database in which new entries are constantly being created, I wanted the paging are not interrupted by the new data creation in the database.

For example, if I get the first page by $top=100, then get second page by $top=100&$skip=100, then the third page by $top=100&$skip=200, in which page size is 100. However, because the database is changing, the data I have skipped may not necessarily be the same data I retrieved from previous requests.

Just like the graph example shows data sorting by entry creation time, the first request and the second request:

I wonder what's the best way to do "Stable Paging"?

Thanks!


回答1:


My current solution follows this post's recommendation - "Paging Through Results" by Markus Winand:

http://use-the-index-luke.com/sql/partial-results/fetch-next-page

It discussed general solutions to stable paging, although it's not OData specific, it works for my scenario.



来源:https://stackoverflow.com/questions/27685887/whats-the-best-practice-to-do-stable-paging-in-odata

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!