AZURE 表存储、ODATA 和更友好的 URI 查询
我想要一个 ODATA 服务,使 Azure 表存储可查询,但我不想强制客户端创建引用 PartitionKeys 和 RowKeys 的查询。 的 ODATA 服务需要什么
http://MyService.svc/Blogs(‘CustomerId’)?startdate eq’12/01/2010’&enddate eq’12/15/2010’
创建一个可以将 URI 查询(例如转换为表存储查询)
var rowKeyStart = startdate;
var rowKeyEnd = enddate;
var query = ctx.SomeBlogsTable.Where(p => p.PartitionKey == ‘CustomerId’ &&
p.RowKey.CompareTo(rowKeyStart) <= 0 &&
p.RowKey.CompareTo(rowKeyEnd) >= 0).Take(1000);
:如果可以这样做,它的优点是使客户端在创建查询时不必了解 Partitionkeys 或 Rowkeys 。但能做到吗?必须通过定制数据服务提供商来完成吗?这样的提供者必须执行什么编码才能执行这样的 URI 查询翻译?
I want to have an ODATA service which makes Azure Table Storage queryable, but I don't want to force the client to have create queries that reference PartitionKeys and RowKeys. What would be needed to create an ODATA service which can convert URI query such as
http://MyService.svc/Blogs(‘CustomerId’)?startdate eq’12/01/2010’&enddate eq’12/15/2010’
to a table storage query such as:
var rowKeyStart = startdate;
var rowKeyEnd = enddate;
var query = ctx.SomeBlogsTable.Where(p => p.PartitionKey == ‘CustomerId’ &&
p.RowKey.CompareTo(rowKeyStart) <= 0 &&
p.RowKey.CompareTo(rowKeyEnd) >= 0).Take(1000);
If this could be done, it has the advantage of freeing the client from having to know about Partitionkeys or Rowkeys in creating the query. But can it be done? Must it be done with a custom data service provider? And what coding does such a provider have to perform to carry out such URI to query translation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有帐户密钥和名称,则可以查询 Azure 表存储。最好的办法是创建您自己的 OData 服务并将其转换为查询。您可以使用 WCF 数据服务工具包来帮助您完成此操作。您可以在此处查看该项目。这会将您的服务公开为 OData 并帮助您编写更新插入等。
Azure table storage is queryable if you have the account key and name. The best thing is to create your own OData service and covert those to a query. You can use the WCF Data Service Toolkit to help you do this. You can check out the project here. This will expose your service as OData and help you write the updates inserts etc.