I have two table with parent child relationship and still confuse how to map it into class from tables. Simple class which encapsulate methods and not using Business Object / Value Object. The tables are category and product.
When a webform list product from a category, what approach I should do?
Create Category object and call GetProductsByGroup(int groupId)
or
create Product object and call GetProductsByGroup(int groupId)
Which class should own the method?
What’s the primary relationship of the method – Products. Thus I’d put it inside the Products class, since it’ll handle everything related to products. Likewise the Category class may have a multitude of methods for handling, querying & modifying categories.