我正在尝试查询表存储,但出现以下错误:
<?xml version="1.0" encoding="utf-8" Standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>无效输入</code>
<message xml:lang="en-US">其中一个请求输入无效。</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();
}
你认为这里的问题是什么?