【发布时间】:2013-08-31 08:42:56
【问题描述】:
我使用以下代码使用来自数据源的数据更新对象上下文中的对象:
public class Project
{
public string Id{get;set;}
public string Name{get;set;}
}
public class People
{
public string Id{get;set;}
public string Name{get;set;}
public IList<Project> ProjectList{get;set;}
}
((System.Data.Entity.Infrastructure.IObjectContextAdapter)Orm).ObjectContext.Refresh(
System.Data.Objects.RefreshMode.StoreWins, people);
它会更新人,但不会更新 ProjectList(导航属性),所以问题是: 如何更新对象及其关系?
【问题讨论】:
标签: entity-framework ef-code-first entity-framework-5 code-first