【发布时间】:2014-05-23 15:35:27
【问题描述】:
我正在使用 Entityframework 开发一个系统,现在已经超过 12 个月了,该项目一直进展顺利,直到昨天,我现在遇到了一个奇怪的错误,我不知道它为什么会发生。 我所做的与我之前所做的没有什么不同,但是一旦我加载有问题的实体并尝试访问任何子实体,我就会收到以下错误:
The entity wrapper stored in the proxy does not reference the same proxy
任何人都可以阐明这实际上意味着什么以及会导致这种情况的原因吗?
显示我的代码并没有真正的帮助。
下面是简化版的代码:
var quote = new QuoteHelper().GetById(orderId);
var updatedQuotes = new Provider().GetExportQuotes(quote.DeparturePoint.Id,quote.DestinationPoint);
访问 DeparturePoint 和 DestinationPoint 时出现错误,但 Quote 正确加载,并且所有属性都已加载。
实体 Quote 看起来有点像这样:
public class Quote : BaseQuote, ICloneable
{
public Guid DeparturePointId { get; set; }
public virtual LocationPoint DeparturePoint{ get; set; }
public Guid DestinationPointId { get; set; }
public virtual LocationPoint DestinationPoint{ get; set; }
}
【问题讨论】:
标签: c# entity-framework