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