テーブルストレージに対してクエリを実行しようとしていますが、次のエラーが発生します。
<?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();
}
ここでの問題は何だと思いますか?