【发布时间】:2014-01-23 08:39:26
【问题描述】:
假设,我有以下父表结构,
public partial class CustomerDetail
{
public CustomerDetail()
{
this.DependentDetails = new HashSet<DependentDetail>();
}
public int CustomerId { get; set; }
public string Title { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Gender { get; set; }
public virtual ICollection<DependentDetail> DependentDetails { get; set; }
}
而子表结构是,
public partial class DependentDetail
{
public int DependentId { get; set; }
public Nullable<int> CustomerId { get; set; }
public string Relationship { get; set; }
public string Gender { get; set; }
public Nullable<System.DateTime> DateOfBirth { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public virtual CustomerDetail CustomerDetail { get; set; }
}
如果我想使用实体框架更新两个表,该怎么做?
请提出建议。
【问题讨论】:
标签: entity-framework c#-4.0 entity-framework-4 linq-to-entities