1

I'm updating a large code base from the now-deprecated WindowsAzure.Storage package to Azure.Data.Tables, and I'm having a hard time figuring out how to convert my queries. I have dozens, maybe hundreds of queries built using TableQuery.GenerateFilterCondition and related methods, for example:

var filter = TableQuery.CombineFilters(
                 TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "PK"),
                 TableOperators.And,
                 TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, "RK")
             );

The best I have been able to figure out, I should now accomplish this by using lambdas, a la:

var query = table.QueryAsync<MyEntity>(i => 
                i.PartitionKey == "PK" && 
                i.RowKey == "RK");

My problem is that some of my queries are complicated, and if I have to convert them all by hand like this, it will be time-consuming and error-prone. In addition, there are a few places in my code where a query filter is modified successively based on various conditions.

So I would like to continue to use the existing TableQuery.GenerateFilterCondition interface if possible. So, to recap:

  1. Is TableQuery deprecated in the current TableStorage APIs?
  2. Is my second example above the correct, new way to perform queries?

Edit: I've started going down the path of just writing my own utility classes that present the same methods as I was using previously. However, it would be nice to use Microsoft's well-tested code if possible. I've been able to find related code in the official Azure GitHub repository, but I can't seem to find this exact code. Any pointers would be much appreciated.

Brian Rak
  • 4,912
  • 6
  • 34
  • 44
  • Closest I could find is [`TableClient.CreateQueryFilter`](https://learn.microsoft.com/en-us/dotnet/api/azure.data.tables.tableclient.createqueryfilter?view=azure-dotnet-preview#azure-data-tables-tableclient-createqueryfilter(system-formattablestring)). – Gaurav Mantri Oct 02 '22 at 00:58
  • pls add link to 'related code in azure repo' – OzBob Nov 01 '22 at 06:27

0 Answers0