读取存储帐户的天蓝色表中的行

问题描述 投票:0回答:1

我有一个表存储,其中包含n个表(表1至表n)。我需要对这些表和从这些表的每一行中读取时间戳记值。]进行迭代。

这是我的代码:

        var storageAccount = CloudStorageAccount.Parse(storageConnectionString);
        var tableClient = storageAccount.CreateCloudTableClient();
        var tables = tableClient.ListTables();
        foreach (var table in tables)
        {
            // read timestamp value in a table row
            var query = new TableQuery<PersonEntity>();            
            foreach (var message in table.ExecuteQuery(query))
            {
                Console.WriteLine(message.Timestamp);
                timestampFromTable = message.Timestamp;
                break;
            }       
        }

是否有更好的方法从表中读取行并避免嵌套for循环?

我有一个表存储,其中包含n个表(表1至表n)。我需要对这些表执行迭代,并从每个表的一行中读取Timestamp值。这是...

c# azure-table-storage
1个回答
1
投票

请尝试以下代码:

© www.soinside.com 2019 - 2024. All rights reserved.