TableQuery 是否支持 OrderBy?

Does TableQuery support OrderBy?

我不知道如何添加 OrderBy clause to a TableQuery with Azure Table Storage

根据 their documentation Azure supports OData $orderby. If I try to hack it by adding $orderby=PartitionKey to the TableQuery Where 子句,'$' 是 HTTP 编码的,因此我收到 400 服务器错误 - 所以破解它是行不通的。这是我的 hack 产生的结果:

GET /devstoreaccount1/NewTable3?$filter=PartitionKey%20ne%20%27pkey992%27%24orderby%3DName&$select=Name%2Cregistered%2CPartitionKey%2CRowKey%2CTimestamp HTTP/1.1

是否 TableQuery support OrderBy,如果是,又如何?

Does TableQuery support OrderBy, and if yes then how?

没有。从今天开始,Table Service 不支持 Order By。请查看支持的列表 LINQ Operators here

您需要做的是获取数据(将按 PartitionKey 和 RowKey 排序)并在客户端应用排序。