如何在 Table 操作中从 Azure Table 存储中指定 rowKey 的情况下检索实体列表?
How to retrieve a list of entities without specifying rowKey from Azure Table Storage in the TableOperation?
如此处所述,似乎没有仅给定 partitionKey 从 azure table 存储中查询实体组的方法。
https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.table.tableoperation.retrieve?view=azure-dotnet
我有几组partitionsKeys,有不同的rowKeys。但是我想查询所有只提供partitionKey的实体。
如何做到这一点?有没有办法使用 Microsoft.Azure.Cosmos.Table 来做到这一点?
我的 rowKey 值不是 incremental/structured,而是唯一的...
谢谢
更新:语法:
public async Task<T>> RetrieveEntitysAsync<T>(string paritionKey) where T : TableEntity, new()
{
TableQuery<MyDataEntity> query = new TableQuery<MyDataEntity>()
.Where(
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "myPartition")
);
await CloudTable.ExecuteQuery(query);
}
检索操作用于从 Table 存储中检索单个实体。这就是您需要同时指定 PartitionKey 和 RowKey 的原因。
如果您想检索多个实体(例如与特定 PartitionKey 值匹配的实体),您要调用的方法是 CloudTable.ExecuteQuery
并向该方法提供查询(例如 PartitionKey eq 'your-partition-key-value'
) .
如此处所述,似乎没有仅给定 partitionKey 从 azure table 存储中查询实体组的方法。 https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.table.tableoperation.retrieve?view=azure-dotnet
我有几组partitionsKeys,有不同的rowKeys。但是我想查询所有只提供partitionKey的实体。
如何做到这一点?有没有办法使用 Microsoft.Azure.Cosmos.Table 来做到这一点? 我的 rowKey 值不是 incremental/structured,而是唯一的... 谢谢
更新:语法:
public async Task<T>> RetrieveEntitysAsync<T>(string paritionKey) where T : TableEntity, new()
{
TableQuery<MyDataEntity> query = new TableQuery<MyDataEntity>()
.Where(
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "myPartition")
);
await CloudTable.ExecuteQuery(query);
}
检索操作用于从 Table 存储中检索单个实体。这就是您需要同时指定 PartitionKey 和 RowKey 的原因。
如果您想检索多个实体(例如与特定 PartitionKey 值匹配的实体),您要调用的方法是 CloudTable.ExecuteQuery
并向该方法提供查询(例如 PartitionKey eq 'your-partition-key-value'
) .