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:
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.
We do not exposed any specialized field for entity types. It needs to be dealt with a custom manner.
Have you looked at working with the heterogeneous entity type section in the following article https://azure.microsoft.com/en-us/documentation/articles/storage-table-design-guide/#working-with-heterogeneous-entity-types.
You can either prepend the entity type to the RowKey or Use a separate property to store the entity type (I think you do not want to do that).
Thanks,
Aung