【发布时间】:2014-02-05 17:39:07
【问题描述】:
我最近将 Microsoft.WindowsAzure.Storage 的 nuget 包更新为 3.0 包,其中还包括对 WCF 数据服务客户端及其依赖项的更新。自更新以来,当查询解析时出现错误:
“客户端和服务之间存在类型不匹配。类型 'ShiftDigital.Flow.Data.RouteDiagnostic' 不是实体类型,而是 响应负载中的类型表示实体类型。请 确保客户端上定义的类型与客户端的数据模型相匹配 服务,或更新客户端上的服务引用。”
除了更新包之外我什么都没做,我的应用程序以及我在 LinqPad 中设置的测试脚本都会生成此异常。
这是我在更新之前返回的实体的定义
public class RouteDiagnostic : TableEntity
{
public long? LeadRecipientRouteId { get; set; }
public bool Successful { get; set; }
public int Duration { get; set; }
public string Request { get; set; }
public string Response { get; set; }
public RouteDiagnostic()
: base()
{
this.Timestamp = DateTimeOffset.Now;
this.PartitionKey = GetPartitionKey(this.Timestamp.Date);
this.RowKey = Guid.NewGuid().ToString();
}
public static string GetPartitionKey(DateTime? keyDateTime = null)
{
return string.Format("{0:yyyyyMM}", keyDateTime ?? DateTime.Now);
}
}
这是执行查询的代码
var storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse("...");
var tableClient = storageAccount.CreateCloudTableClient();
var tableContext = new Microsoft.WindowsAzure.Storage.Table.DataServices.TableServiceContext(tableClient);
var diagnostics =
tableContext.CreateQuery<RouteDiagnostic>("RouteDiagnostic")
.Where(rd => rd.PartitionKey == "0201401")
.ToList();
在使用数据服务查询时,在最新更新中或以不同的方式构造实体是否发生了某些变化?
【问题讨论】:
标签: azure wcf-data-services azure-storage azure-table-storage