Performing an Azure table storage case-insenstive query

Viewed 7920

This may be somewhat related to this SO question How to perform a case-sensitive LINQ query in Azure?. However I'm using Storage Client 3.0, not the linq queries and the TableStorageContext in that question.

I have a table storage entity called Account that has a string property for email address. The email property is not a partition key or a row key.

I want to search for an entity with a matching email address in a case-insensitive way, such that a search for "bob@test.com" returns "Bob@Test.com", etc.

My code looks something like this:

TableQuery<Account> rangeQuery = new TableQuery<Account>().Where(
    TableQuery.CombineFilters(
        TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "account"),
        TableOperators.And,
        TableQuery.GenerateFilterCondition("Email", QueryComparisons.Equal, email)));

var results = accountsTable.ExecuteQuery(rangeQuery).ToList();

Is there a way to perform a case insensitive query using the tableQuery class, or is there another approach? Should I just concentrate on data grooming and ensure that all data is forced to a consistent case?

2 Answers
Related