0

Windows Azure テーブル ストレージのテーブルから行を選択しようとすると、奇妙なエラーが発生します。「同じキーを持つアイテムが既に追加されています」という例外。何も挿入していないのに投げられています。問題の原因となっているクエリは次のとおりです。

var ids = new HashSet<string>() { id };
var fields = new HashSet<string> {"@all"};
using (var db = new AzureDbFetcher())
{
     var result = db.GetPeople(ids, fields, null);
}

public Dictionary<string, Person> GetPeople(HashSet<String> ids, HashSet<String> fields,     CollectionOptions options)
{
    var result = new Dictionary<string, Person>();
    foreach (var id in ids)
    {
         var p = db.persons.Where(x => x.RowKey == id).SingleOrDefault();
         if (p == null)
         {
                continue;
         }
       // do something with result
    }
}

ご覧のとおり、id は 1 つしかなく、ループの先頭でエラーがスローされ、何も変更されていません。

ただし、この特定の行のパーティション キーとして "" を使用しています。何を与える?

4

1 に答える 1