检查 AzureTable 是否有任何数据的最简单有效的方法?
Simplest and efficient way to check if a AzureTable has any data?
我需要一种方法来了解查看 Azure 存储中的 table 是否有任何数据的最有效方法
例子
cloudTable.ExecuteQuery("what do i do");
感谢您的建议!我终于做了这样的事情:
var query = new TableQuery<T>()
{
TakeCount = 1,
SelectColumns = new List<string>()
{
"PartitionKey"
}
};
var table = await this.GetTableAsync();
var segment = await table.ExecuteQuerySegmentedAsync(query, null);
return segment.Results.Any();
如果有数据,您可以这样做,将查询限制为 1 条记录。
// select value = take smallest data field to avoid returning everything for a record
var query = new TableQuery().Select(new List<string>(){"smallcolumn"}).Take(1);
我需要一种方法来了解查看 Azure 存储中的 table 是否有任何数据的最有效方法
例子
cloudTable.ExecuteQuery("what do i do");
感谢您的建议!我终于做了这样的事情:
var query = new TableQuery<T>()
{
TakeCount = 1,
SelectColumns = new List<string>()
{
"PartitionKey"
}
};
var table = await this.GetTableAsync();
var segment = await table.ExecuteQuerySegmentedAsync(query, null);
return segment.Results.Any();
如果有数据,您可以这样做,将查询限制为 1 条记录。
// select value = take smallest data field to avoid returning everything for a record
var query = new TableQuery().Select(new List<string>(){"smallcolumn"}).Take(1);