Domain:
class Category
string Name
class Product
IDictionary<string, Product> Parents
Tables:
Categories (ID, Name)
Products (ID)
ProductParents (ID, ParentID, ChildID, CategoryID)
The questions: I need to get list of parent products. Is it possible to map parent products to dictionary so that I can do: product.Parents["CategoryName"] and it will give me a list of parent products for the given category.
Or maybe
product.Parents[Category("CategoryName")]
if I use
IDictionary<Category, Product> Parents
Or how do I do this? Maybe a method like product.GetParentProducts(string category) instead of properties? I'd rather use dictionary, though.
Notice that I don't really want to introduce ProductMapping class.