I'm developing an application, that allows using dictionaries (e.g. English - German or Country - Capital). There are just 2 very plain tables:
1) Dictionary:
int Id, string Title //PartitionKey="SomeConstString", Rowkey=Id.ToString()
2) Article:
int DictionaryId, string Word, string Meaning //PartitionKey="D" + DictionaryID, Rowkey=Word
I can add articles, but when trying to delete I get the following problem: in every dictionary one or two articles are not deleted. Instead I get ResourceNotFoundException. There is absolutely nothing special about those articles (e.g. Russia - Moscow). When I try to add articles with same PartitionKey and RowKey I get EntityAlreadyExistsException. I installed "Cloud Storage Studio" and found out that those entities are really still in table. I tried to delete them manually but got the same ResourceNotFoundException in storage studio that I was getting in code. So if I add 100 articles and then try to delete them (in code or in studio like Ctrl+A -> Delete), 99 (or sometimes 98) are deleted and others are not. I'm using development storage emulator. Here is how I remove articles (I tried different approaches, result is still the same):
public void DeleteAllArticlesFromDictionary(int dictionaryID) {
TableServiceContext tableServiceContext = tableClient.GetDataServiceContext();
string partitionKey = "D" + dictionaryID;
Article[] articles = tableServiceContext.CreateQuery<Article>(articleTableName).Where(a => a.PartitionKey == partitionKey).ToArray();
for (int i = 0; i<articles.Length; ++i)
tableServiceContext.DeleteObject(articles[i]);
tableServiceContext.SaveChanges();
}
Can anyone tell me what can possibly be wrong with this? UPD: Works fine in Cloud