I have setup a domain project which is being populated with an ORM. The domain contains of different aggregates each with its own root object. My question is how properties that cross the aggregate boundries should be treated?
- Should these properties simply ignore the boundries so that a domain object in bounded context A has a reference to an object in context B?
- Or, should there be no direct link from context A to B and does the object in context A have an "int ContextBId" property that can be used to get the domain object from B through the B aggregate root?
- Or ...
An example:
Context A = Users
Context B = Games
Inside the Users
context there is an object UserOwnedGames
. This object has a property User
which is a reference to an object in the same Users
context. The object also has a property to a Game
which is obviously not in the Users but rather in the Games
context.
How would (or should?) this relation look like? It's clear in the database (ie 2 foreign keys) but what should the code look like?