进行“稳定分页"的最佳实践是什么?在OData中? [英] What's the best practice to do "stable paging" in OData?

查看:61
本文介绍了进行“稳定分页"的最佳实践是什么?在OData中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这篇文章的评论中(问题与WCF数据服务(OData),SetEntitySetPageSize和自定义操作),它提到了"OData稳定分页".

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

我对OData很陌生,并尝试在OData查询中获得稳定的分页.

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

通过稳定分页",我的意思是有一个OData数据库,其中不断创建新的条目,我希望分页不会被数据库中新数据的创建打断.

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.

例如,如果我通过$top=100获得第一页,然后通过$top=100&$skip=100获得第二页,然后通过$top=100&$skip=200获得第三页,其中页面大小为100.但是,由于数据库正在变化,我跳过的数据不一定与我从先前请求中检索到的数据相同.

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"?

谢谢!

推荐答案

我当前的解决方案遵循这篇帖子的建议-Markus Winand的通过结果分页":

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

它讨论了稳定分页的一般解决方案,尽管它不是特定于OData的,但它适用于我的情况.

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

这篇关于进行“稳定分页"的最佳实践是什么?在OData中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆