Reputation: 2000
I am using the method tableServiceContext.CreateQuery and now (After upgrading to Azure SDK 2.5) it says that *
Support for accessing Windows Azure Tables via WCF Data Services is now obsolete. It's recommended that you use the Microsoft.WindowsAzure.Storage.Table namespace for working with tables.
*
So can anyone suggest an alternative for this method in the Microsoft.WindowsAzure.Storage.Table namespace. I am sharing the code below
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));
The TableServiceContext class is also deprecated.
Upvotes: 2
Views: 1727
Reputation: 136366
Take a look at CloudTable.CreateQuery
. Here's a sample code which makes use of it:
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();
Upvotes: 4