0
我正在嘗試使用現有數據庫爲我的數據模型創建導航屬性。數據有一個共享密鑰(像一個外鍵),但它沒有在數據庫中指定。下面是它的樣子:創建沒有外鍵的導航屬性?
[Table("Alpha")]
public class Alpha
{
public int AlphaID { get; set; }
public int AlphaGroupID { get; set; }
public int? ParentAlphaID { get; set; }
public int? CodeID { get; set; }
public int? BracketCodeID { get; set; }
public string Title { get; set; }
}
[Table("AlphaGroup")]
public class AlphaGroup
{
[Column("AlphaGroupID")]
public int AlphaGroupID { get; set; }
public string Title { get; set; }
public string TitleAddon { get; set; }
}
AlphaGroupID需要是AlphaGroupID的導航屬性,但不是外鍵。有沒有辦法做到這一點?