0
我有一個包含兩個類的視圖模型。 這些類與另一類,一對多和一對一的關係有關。 如何將數據從viewmodel傳遞到與其他表格有關的表格中? 例如:在視圖模型中使用的類的填充表
public class A
{
public int a_id { get; set; }
public string a_field1 { get; set; }
...
//one-to-many with B
public virtual ICollection<B> Bs { get; set; }
//one-to-one with D
public virtual D Ds { get; set; }
}
public class B
{
public int B_id { get; set; }
public string B_field1 { get; set; }
...
public int a_id { get; set; }
public int c_id { get; set; }
// one-to-many with A , C
public virtual A As { get; set; }
public virtual C Cs { get; set; }
}
public class C
{
public int C_id { get; set; }
public string C_field1 { get; set; }
...
// one-to-many with B
public virtual ICollection<B> Bs { get; set; }
// one-to-one with E
public virtual E Es { get; set; }
}
我的視圖模型是由A和B maked如何添加相關信息,分爲A將距B和虛擬實例從d的集合? 或者在B中有來自A和C的虛擬實例嗎? 我是否更改我的視圖模型? 請指導並給我建議。
這是一個非常模糊的答案......如果您包含一些代碼,對未來的讀者會更有幫助。 –