I'm facing the following issue: I have a very simple aggregate root
Product, and a product contains
Right now in code this relationship is expressed as a Many to One relationship like this:
class Product: Image images;
Now it happens that I need to make that relationship a Many to Many relationship, and a single image can be used by multiple products. Vaughn Vernon in one of its rules for aggregates states to only reference aggregate roots by ID to avoid transactional collisions.
Does that mean that I should turn the Entity Image into an aggregate root and change the product class to hold an array of Image IDs to solve my problem? What would be the best solution?