I have a single table in Azure Table Storage (well, actually in the emulator) which contains multiple entity types, two of which are AzureRuleInfo and AzureCostCodeInfo. I want to pull out a range of AzureRuleInfo and AzureCostCodeInfo entities from the same partition.
I started off with two table queries, one for each type, on the assumption that new TableQuery<T>()
would return only entities of type T - but it seems to pull back everything that matches the partition key.
TableQuery<AzureRuleInfo> query = new TableQuery<AzureRuleInfo>()
.Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, financialPeriodId));
TableQuery<AzureCostCodeInfo> query = new TableQuery<AzureCostCodeInfo>()
.Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, financialPeriodId));
My question is:
- Does the API offer a way of querying by entity type? (Preferably without having to add a custom entity property like "MyEntityType").
- Or am I better off pulling back everything and filtering the results into two separate collections?
This is for a personal app, my first foray into Azure Table Storage, so I don't have any specific design drivers such as performance.