0
我試圖在網上商店項目中創造購買歷史,我希望課程歷史能夠從購物車獲得產品,我從來沒有做過多關係-one(我認爲這是最不適合的),你怎麼看待它?MVC-5中的一對多關係
public class Clothes
{
[Key]
public int Id { get; set; }
public ClothesType Type { get; set; }
public int Amount { get; set; }
[Range(10, 150)]
public double Price { get; set; }
public string ImagePath { get; set; }
public virtual History historyID { get; set; }
}
public class History
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int historyID { get; set; }
public string Email { get; set; }
public string Address { get; set; }
public string City { get; set; }
public DateTime ShipDate { get; set; }
public int Price { get; set; }
public virtual ICollection<Clothes> HistClothes { get; set; }
}
你的命名看起來很混亂。一個「歷史」(那是什麼)有許多「信仰」?一個具有複數名字的班級似乎很奇怪...... – oerkelens