2
class Category
string Name
class Product
IDictionary<string, Product> Parents
表:
Categories (ID, Name)
Products (ID)
ProductParents (ID, ParentID, ChildID, CategoryID)
的問題:我需要得到家長的產品清單。是否有可能將父母產品映射到字典,以便我可以這樣做: product.Parents [「CategoryName」] 它會給我一個給定類別的父級產品列表。
或許
product.Parents[Category("CategoryName")]
如果我使用
IDictionary<Category, Product> Parents
或者我該怎麼做呢?也許像product.GetParentProducts(字符串類)而不是屬性的方法?不過,我寧願使用字典。
請注意,我並不想介紹ProductMapping類。
謝謝指出。但是,據我所見,這是可用的,作爲http://code.google.com/p/fluent-nhibernate/issues/detail?id=226的一部分進行了修正,並已集成到http://code.google的.com/p /流利-的nhibernate /源極/細節?R = 524。我將獲取並測試最新版本。 – queen3 2009-06-10 15:13:22