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’&e开发者_运维知识库nddate 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?
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.
精彩评论