因此。我使用ASP.NET MVC创建了web-app,这有助于
我如何在Entity Framework中创建此数据库,还是应该更改概念?
TABLE order //Table for orders
Id int,
Person nvarchar(50),
TABLE meal //List of meals
Id int
Description nvarchar(50)
TABLE meal-order //Many-to-one table with count of meals
IdOrder int,
IdMeal int,
Count tinyint
这个想法是:我希望订购两个Pepperoni和Coke,我的订单将被保存为:
TABLE order
orderId, My Name
TABLE meal (it has some stuff)
pepperoniId, Pepperoni
cokeId, Coke
hotDogId, Hot Dog
TABLE meal-order
orderId, pepperoniId, 2 (and here 2 is count of pepperoni I ordered)
orderId, cokeId, 1 (just one coke)
有可能用柜台实现餐订单吗?如果它很难,你能为我的数据库提出另一种表格概念吗?
答案 0 :(得分:0)
这几乎是一个经典的Order
- OrderDetail
- Product
模型,其中Meal
是Product
和{{1}是MealOrder
。我更愿意调用OrderDetail
实体/表MealOrder
,因为它引用OrderDetail
的事实可能只是许多属性中的一个。例如,Meal
可能还有一个OrderDetail
属性与膳食没有直接关系,而是与订单的放置时间有关("周一所有饮品可享受30%折扣) !"。)
实体模型可能如下所示:
Discount
数据库表就像你的问题中草绘的那样。