首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >替代TableServiceContext.CreateQuery

替代TableServiceContext.CreateQuery
EN

Stack Overflow用户
提问于 2015-08-05 08:52:40
回答 1查看 1.6K关注 0票数 2

我正在使用tableServiceContext.CreateQuery方法,现在(升级到AzureSDK2.5之后)它说*

现在,通过WCF数据服务访问Windows表的支持已经过时。建议您使用Microsoft.WindowsAzure.Storage.Table命名空间来处理表。

*

因此,任何人都可以在Microsoft.WindowsAzure.Storage.Table命名空间中为该方法提出替代方案。我正在分享下面的代码

代码语言:javascript
复制
 TableServiceContext tableServiceContext = this.tableClient.GetTableServiceContext();
            var query = (from e in this.tableServiceContext.CreateQuery<AuditLoggerEntity>(tableName)
                         where e.PartitionKey == organizationGuid && e.QueueMessageStatus != "Completed" && e.Action == "UpdateIdentityClaim"
                         select e).Take(resultsPerPage).AsTableServiceQuery<AuditLoggerEntity>(tableServiceContext);

            // Get the next continuation token
            var response = query.EndExecuteSegmented(query.BeginExecuteSegmented(nextToken, null, null));

也不推荐使用TableServiceContext类。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-05 10:16:28

看看CloudTable.CreateQuery。下面是一个使用它的示例代码:

代码语言:javascript
复制
        var account = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
        var tableClient = account.CreateCloudTableClient();
        var table = tableClient.GetTableReference("Address");
        var tableQuery = from e in table.CreateQuery<DynamicTableEntity>()
            where e.PartitionKey == "Address"
            select e;
        var queryResult = tableQuery.AsTableQuery().ExecuteSegmented(null).ToList();
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31827750

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档