【发布时间】:2011-09-24 03:57:32
【问题描述】:
我有这门课
public class Comment
{
public long Id { get; set; }
public string Body { get; set; }
public long OwnerId { get; set; }
public virtual Account Owner { get; set; }
public DateTime CreationDate { get; set; }
}
问题是虚拟财产所有者是我在做时得到null object reference exception:
comment.Owner.Name
在保存对象后立即调用此方法(来自同一 DbContext 实例) 使用新的上下文将起作用
有人知道吗?
【问题讨论】:
标签: entity-framework entity-framework-4.1