c# - 将 ODataQuery 转换为 TableQuery 以使用 OData 查询 Azure 表存储

标签 c# azure odata azure-storage azure-table-storage

我正在使用 Azure 表存储,并且希望能够使用 OData 进行查询。我遇到过Microsoft.Rest.Azure.OData.ODataQuery类,但我找不到任何如何使用它的示例。

CloudTable对象允许通过 TableQuery<T> 进行查询对象,那么有没有办法转换 ODataQueryTableQuery

我知道早期版本的 Azure 表存储使用了底层 OData API,但我不知道情况是否仍然如此,而且我还没有找到任何详细说明该表是否可以通过 OData 公开的文档。

谁能解释一下如何使用 OData 查询 Azure 表存储 - 最好是通过库?

编辑:
为了清楚起见,我知道表存储公开了一个接受 OData 查询的 REST API;我正在寻找一种以编程方式传递 OData 查询的方法:如果我有 ODataQuery对象,我如何使用它来查询 CloudTable对象?

最佳答案

Can anyone explain how to query Azure table storage using OData - ideally through a library?

我们可以从Querying Tables and Entities得到答案。 我们还可以从 Get started with Azure Table storage using .NET 获取 C# 演示代码

The Table service supports the following query options, which conform to the OData Protocol Specification. You can use these options to limit the set of tables, entities, or entity properties returned by a query.

enter image description here

更新:

如果我们使用 fiddler 捕获库请求,我们可以得到库将在发送请求之前构造 OData 查询。

enter image description here

That I'm looking for is a way to pass the OData query programmatically: If I have an ODataQuery object, how can I use this to query a CloudTable object?

目前,Azure表存储不完全支持OData协议(protocol)规范。据我所知,不支持直接使用OdataQuery对象。

您可以给您的 feedback致 azure 团队。

关于c# - 将 ODataQuery 转换为 TableQuery 以使用 OData 查询 Azure 表存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49224951/

相关文章:

c# - 使用 WPF 捕获视频的第一帧

C# mysql插入查询,如果记录存在则更新

c# - 更改部分类中的 LINQ2SQL 属性?

asp.net-mvc-3 - 如何授予 Windows Azure 中文件夹的 RW 权限?

c# - 如何在Azure Function中配置OpenApiRequestBody?

c# - 处理 DataServiceContext?

sql - OData 相关字段选择语法

wcf-data-services - 从 .net 客户端使用服务操作给我一个错误

c# - 是否有在 C# (Unity) 中编写异步委托(delegate)的优雅解决方案

postgresql - 在 Azure 云中创建新的 Postgres 方案以供 Offer-Ready - "Non empty schema"