gpt4 book ai didi

c# - Azure表: Retrieve entire table

转载 作者:行者123 更新时间:2023-11-30 21:47:11 24 4
gpt4 key购买 nike

我知道如何从 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(...);

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

最佳答案

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

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);

关于c# - Azure表: Retrieve entire table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38677788/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com