1

テーブルストレージに対してクエリを実行しようとしていますが、次のエラーが発生します。

<?xml version = "1.0" encoding = "utf-8" Standal = "yes"?>

<error xmlns = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<code> InvalidInput </ code>

<messagexml:lang="en-US">リクエスト入力の1つが無効です。</message>

</エラー>

私が使用するコードは次のとおりです。

public IEnumerable<ShoppingItemEntity> Get(string shoppingRowKey) {

    var ctx = getTableServiceContext();
    var shoppingItems = ctx.CreateQuery<ShoppingItemEntity>(
        Constants.TABLE_STORAGE_SHOPPING_ITEM_TABLE_NAME
    ).Where(x => x.PartitionKey == string.Empty && x.ShoppingId == shoppingRowKey).AsTableServiceQuery();

    return shoppingItems.ToList();
}

private TableServiceContext getTableServiceContext() {

    var account = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["DataConnectionString"]);
    return account.CreateCloudTableClient().GetDataServiceContext();
}

ここで奇妙なのは、where句を指定せずにクエリを実行しても、エラーが発生しないことです。

public IEnumerable<ShoppingItemEntity> Get(string shoppingRowKey) {

    var ctx = getTableServiceContext();
    var shoppingItems = ctx.CreateQuery<ShoppingItemEntity>(
        Constants.TABLE_STORAGE_SHOPPING_ITEM_TABLE_NAME
    ).AsTableServiceQuery();

    return shoppingItems.ToList();
}

ここでの問題は何だと思いますか?

4

1 に答える 1

4

ここに記事があり、ここに、Azure テーブル ストレージで経験した同様の経験が示されています。Azure Development Storage を扱うときは、ダミー エンティティを挿入して、自分が何をしているのかをテーブル サービス プロバイダーに "納得させる" 必要があります。

この記事Azure Table Storage, what a pain in the ass を気に入っていただけると思います。

于 2012-06-10T17:24:04.923 に答える