剛學MVC3+EF,請教下EF導航屬性是怎麼關聯的?運行一直報錯
A表 “rr_Id”和B表的“rd_Id”是主外鍵關係,(rd_Id和rc_Id是個組合主鍵),rc_Id和C表的rc_Id又是主外鍵關係,下面是我的3個實體類
public class A
{
[Key]
public int rr_Id { get; set; }
public string rr_requsr { get; set; }
public string rr_reqext { get; set; }
public System.DateTime? rr_date { get; set; }
public string rr_dept { get; set; }
public string rr_typ { get; set; }
public System.DateTime? rr_reqdate { get; set; }
public string rr_reason { get; set; }
public string rr_remark { get; set; }
public virtual SJResourceReqDtl SJResourceReqDtl { get; set; }
}
[Table("SJResourceReqDtl")]
public partial class B
{
[Key, Column("rd_Id", Order = 1)]
public int rd_Id { get; set; }
[Key, Column("rc_Id", Order = 2)]
public int rc_Id { get; set; }
public Nullable<short> rd_qty { get; set; }
public string rd_desc { get; set; }
public virtual SJResourceReqDtl SJResourceReqMAS { get; set; }
public virtual SJResourceCatMAS SJResourceCatMAS { get; set; }
}
public partial class C
{
[Key]
public int rc_Id { get; set; }
public string rc_cat { get; set; }
public string rc_code { get; set; }
public string rc_desc { get; set; }
public string rc_uom { get; set; }
public string rc_sts { get; set; }
public string lusr { get; set; }
public System.DateTime? ldte { get; set; }
//public List<SJResourceReqMAS> SJResourceReqMASs { get; set; }
}
补充:.NET技术 , ASP.NET