2

我知道如何从 Azure 表中获取一些表实体,如下所示:

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(...);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("table");
TableOperation retrieveOperation = TableOperation.Retrieve(...);
TableResult retrievedResult = table.Execute(retrieveOperation);

或者

TableQuery<MyEntity> query = new TableQuery<MyEntity>().Where(TableQuery.GenerateFilterCondition(...);

但我想知道:有没有一种很好的方法来检索整个表?

4

1 回答 1

3

您可以使用 aTableQuery来获取整个表格。

var list = new List<MyEntity>();
var table = tableClient.GetTableReference("table");
var tableQuery = new TableQuery<UserEntity>();
TableContinuationToken continuationToken = null;
do
{
    var query = await table.ExecuteQuerySegmentedAsync(
        tableQuery, continuationToken).ConfigureAwait(false);
    list.AddRange(query.Results);
    continuationToken = query.ContinuationToken;
} while (continuationToken != null);
于 2016-07-30T19:41:33.107 回答