2
我正在使用現有數據庫上的POCO實體模型。 的表具有鍵指向複合鍵的外鍵
public class Table1
{
[Key]
public virtual int Key1 {get; set;}
[Key]
public virtual int Key2 {get; set;}
public virtual ICollection<Table2> Tables2 {get; set;}
//more properties here...
}
的化合物,並與沒有主密鑰的第二表,但2個屬性引用表1的化合物鍵。
public class Table2
{
public virtual int Key1 {get; set;}
public virtual int Key2 {get; set;}
[InverseProperty("Tables2")]
public virtual Table1 Table1 {get; set;}
//more properties here...
}
問題可以使用地圖這DataAnnotations協會? 如果是這樣,怎麼樣?
用於EF具有如此多屬性的實體是POCO? –