【发布时间】:2011-11-05 09:35:45
【问题描述】:
我有一个如下所示的数据库:
Product: PK(ProductId), ProductName.......
Store: PK(StoreId), StoreName......
ProductStore: PK(ProductId, StoreId), Price, Quantity
这里我有Product 和ProductStore 之间的1-many,以及Store 和ProductStore 之间的1-many。当我创建模型时,我基本上有类似的东西
Product.ProductStores
这在编写 UI 时会产生问题(例如数据绑定)。当我使用模型时,查询数据将始终在ProductStores 集合中只返回一个ProductStore,因为我总是一次使用一个商店(PK:ProductID+StoreId)。我还需要为商店提供通用产品表,因此ProductStoreTable 的必要性。
有没有办法可以在模型 1->0..1 中表示 Product->ProductStore,实际上是在数据库 1->many 中?
谢谢, 戈兰
【问题讨论】: