我有这个小代码来读取表存储的所有条目。这是我的简单模型:
public class LineEntity : TableServiceEntity
{
public XElement Data { get; set; }
public LineEntity(string rowKey)
{
PartitionKey = "Line";
RowKey = rowKey;
}
public LineEntity()
{
}
}
以下是阅读它的代码:
var StorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
var TableClient = StorageAccount.CreateCloudTableClient();
var ServiceContext = TableClient.GetDataServiceContext();
var models = ServiceContext.CreateQuery<LineEntity>("lines").ToList();
由于某种原因,最后一行将在云中抛出以下异常:
<?xml version="1.0" encoding="utf-8"?><Error><Code>OutOfRangeInput</Code><Message>One of the request inputs is out of range.
RequestId:8a16121a-237c-4015-99cb-b1bbdb7ab7a7
Time:2012-04-30T07:39:42.6396851Z</Message></Error>
它在开发中完美无缺。关于这个的任何线索?
谢谢,
答案 0 :(得分:1)
不应该这一行
var models = ServiceContext.CreateQuery<Line>("lines").ToList();
而不是
var models = ServiceContext.CreateQuery<LineEntity>("lines").ToList();