I am getting this error while executing this query against Azure table storage:
var query = table.CreateQuery<DynamicTableEntity>()
.Where(d => d.PartitionKey == partitionId
&& d.Properties["Content"].StringValue.Contains("Polly"))
).AsTableQuery();
var result = table.ExecuteQuery<DynamicTableEntity>(query);
foreach (var entity in result)
{
//Do stuff
}
The error happens when executing this line:
foreach (var entity in result)
Now, the error and stacktrace are not very useful, but I was able to determine that the error is caused by the inclusion of this condition:
d.Properties["Content"].StringValue.Contains("Polly")
Remove this line and the problem disappear.
There is some sort of limitation about the usage of methods like "Contains" in a TableQuery? If so there is any workaround, so that I can filter the rows that contain a given string in the field "Content"?
There is some sort of limitation about the usage of methods like "Contains" in a TableQuery?
This is correct. Azure Table Storage has support for limited number of LINQ operators and Contains
is not one of them. For the list of support LINQ operators please see this link: https://learn.microsoft.com/en-us/rest/api/storageservices/query-operators-supported-for-the-table-service.