Where does the logic for deleting / not deleting dependent objects belong to DDD?
For example, you have a category containing products:
class Category { IList<Products> products; }
A rule may be that you cannot delete a category if it does not have products.
Where is the logic that checks for the absence of products in this category before uninstalling?
- Domain classes. This is apparently business logic, so I would suggest that it belongs to the domain layer.
- Repository classes. The repository level handles persistence, it has common CRUD methods, including one for deletion, does the logic contain in this layer?
- Another solution?
source share