我有以下 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 飞机(作为左翼或右翼)或其他一些“飞行装置”。删除飞机应该级联删除它的机翼。
如何在代码优先的 fluent API 中进行配置?
是否有可能在 EF 中有两个 0..1 --- 1 关联,并且两者都有级联删除?