本文介绍了带有WCF和Azure表的系统URI参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用System.Data.Services.DataService< T>将Azure表存储公开为WCF服务,如以下博客所示:

I am currently using System.Data.Services.DataService<T> to expose Azure table storage as a WCF service as demonstrated in the following blog:

http://blogs.southworks.net/fboerr/2010/07/29/create-a-wcf-data- service-odata-to-share-an-azure-table /

此方法适用于大多数查询,我可以获取ajax调用的json数据。我能够使用$ filter来过滤数据,但其他系统URI参数会导致异常。问题是我现在需要分页数据,当我尝试使用$ top和$ skip系统URI参数时,我得到一个异常

This method works fine for most queries and I can get json data for ajax calls. I am able to use $filter to filter the data, but other system URI parameters are causing exceptions. The issue is that I now need to page the data and I am getting an exception when I try to use the $top and $skip system URI parameters:

An error occurred while processing this request.
System.Data.Services.Client.DataServiceQueryException
   at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
   at System.Data.Services.Client.DataServiceQuery`1.Execute()
   at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
   at System.Data.Services.Client.DataServiceQuery`1.System.Collections.IEnumerable.GetEnumerator()
   at System.Data.Services.WebUtil.GetRequestEnumerator(IEnumerable enumerable)
   at System.Data.Services.DataService`1.SerializeResponseBody(RequestDescription description, IDataService dataService)
   at System.Data.Services.DataService`1.HandleRequest()
-- Inner Exception --
NotImplemented: The requested operation is not implemented on the specified resource.
System.Data.Services.Client.DataServiceClientException
   at System.Data.Services.Client.QueryResult.Execute()
   at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)

我可以看到使用Fiddler底层的WCF service(abcxyz.table.core.windows.net)支持$ top并使用NextPartitionKey和NextRowKey来实现分页/继续。我想在我的应用程序中启用此功能或复制此类型的分页

I can see from using Fiddler that the underlying WCF service (abcxyz.table.core.windows.net) supports $top and uses NextPartitionKey and NextRowKey to implement paging/continuation. I would like to enable this functionality or duplicate this type of paging in my application.

Is DataService< T>如果我需要在浏览器中进行客户端分页/继续,那么使用正确的类?有没有更好的方法来公开Azure表数据?

Is DataService<T> the correct class to use if I need client-side paging/continuation in a browser? Is there a better way to expose the Azure table data?

推荐答案

所以问题是,为什么需要包装已经存在的数据服务(表存储作为OData数据服务暴露在另一个数据服务中,为什么你不能简单地暴露表存储本身。

So the question is, why do you need to wrap already existing data service (the table storage is exposed as an OData data service) with yet another data service, why can't you simply expose the table storage itself.

这种方法我们把Astoria称为Astoria,它确实是难以使其正常工作。您可以在OData Provider Toolkit中看到一个示例代码:

http://www.odata.org/developers/odata-sdk#/media/7579/odataprovidertoolkit.zip

This approach we call Astoria over Astoria, and it's really hard to make it work correctly. You can see a sample code of how one could go about it in the OData Provider Toolkit :http://www.odata.org/developers/odata-sdk#/media/7579/odataprovidertoolkit.zip

它在实验中/ AstoriaOverAstoria。但是请不要在生产环境中使用它,它实际上只是作为样本。

It's under Experimental/AstoriaOverAstoria. But please do not use this in a production environment, it's really meant as a sample only.

谢谢,


这篇关于带有WCF和Azure表的系统URI参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 00:09