0
我試圖找出如何導航屬性在這種情況下增加的主要實體 - (也許是不可能的雙主鍵):實體自定義導航性能
public class EntityA
{
[Key]
public int EntityAPrimaryKey1 { get; set; }
[Key]
public int EntityAPrimaryKey2 { get; set; }
//What goes here?
public virtual EntityB EntityB { get; set;}
}
public class EntityB
{
[Key]
public int EntityBPrimaryKey { get; set; }
[Column(Order = 1)]
public int EntityAPrimaryKey1 { get; set; }
[Column(Order = 2)]
public int EntityBPrimaryKey2 { get; set; }
[ForeignKey("EntityAPrimaryKey1,EntityAPrimaryKey2")]
public virtual EntityA EntityA { get; set; }
}