【发布时间】:2012-10-10 11:16:52
【问题描述】:
我有以下 Entity Framework 5 代码第一类
public class Airplane
{
public int Id { get; set; }
public int LeftWingId { get; set; }
public virtual Wing LeftWing { get; set; }
public int RightWingId { get; set; }
public virtual Wing RightWing { get; set; }
}
public class Wing
{
public int Id { get; set; }
}
飞机有一个左翼和一个右翼(两者都是必需的)。机翼可能属于 0..1 飞机(作为左翼或右翼)或其他一些“飞行装置”。 删除飞机应该级联删除它的机翼。
如何在 code-first fluent API 中进行配置?
是否可以在 EF 中有两个 0..1 --- 1 关联并在两者上进行级联删除?
【问题讨论】:
标签: ef-code-first associations entity-framework-5