English 中文(简体)
WCF 数据服务——如何从方案角度确定页数?
原标题:WCF Data Service - How to set Page Size programmatically?

我有一个使用WCF数据服务(v2)的OData服务,设在服务器上。 在我们创造的客户应用中,我们想知道,我们是否有办法以方案方式确定老龄化的规模?

例如,如果我把这项工作安排在.svc:

public static void InitializeService(ODataServiceConfiguration serviceConfig)
{
    serviceConfig.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
    serviceConfig.SetEntitySetAccessRule("*", EntitySetRights.All);
    // *** I would like to set the following in my client code
    serviceConfig.SetEntitySetPageSize("Employees", 100);
    ...

任何建议都将受到赞赏。

最佳回答

服务器的配制仅限在服务器上,但可以使用<条码><<>>>和<条码>,供用户直接使用。

var data = (from e in context.Entities
            select e).Skip(200).Take(100);

这一实例将使200个实体得以建立,并将实体退回201个至300个。 如果每页有100个实体,则选择第三页。

问题回答

暂无回答




相关问题
What is purpose of UpdateObject for Linq to REST?

When one is using ADO.NET Data Services and consuming it via the Linq to REST (formerly Project Astoria), it doesn t seem to be as intuitive as it could be. Namely, with normal Linq to SQL, the ...

ADO.NET DataServices with Prism

I ve start using prism with silverlight 3, but, we are trying to implement it to work with ADO.NET DataServices. The "DataServiceQuery" query type required to use with Silverlight, requires a ...

ADO.NET Data Services - Uploading files

I am trying to write REST web service through which our clients can upload a file on our file server. IS there an example or any useful links which I can refer for any guidance? I haven t seen many ...

热门标签