Is TableQuery.GenerateFilterCondition no longer available in Azure.Data.Tables?

723 Views Asked by At

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.

0

There are 0 best solutions below