我正在尝试从表中进行查询,以便名称和分区键(组合(是唯一的。我现在正在做这个:
public Spec(string name)
{
Query = new TableQuery<TableEntity>()
.Where(TableQuery.GenerateFilterCondition(nameof(table.Name), QueryComparisons.Equal, name));
}
但我还需要检查这个名称中是否存在分区键。因此需要查询该表以及分区键和名称。有人能帮忙吗?如何将这些作为组合查询进行查询。
请尝试以下内容:
public Spec(string name)
{
var filterCondition1 = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "PartitionKeyValue");
var filterCondition2 = TableQuery.GenerateFilterCondition(nameof(table.Name), QueryComparisons.Equal, name);
Query = new TableQuery<TableEntity>()
.Where(TableQuery.CombineFilters(filterCondition1, "AND", filterCondition2));
}