Reputation: 958
I have been using DDD for a while know so I am comfortable with the idea of aggregates. At first I did have troubles wrapping my head around not using/persisting references to other root aggregates but I think I'm on board... so:
For the times that I DO want to have a full reference to another root aggregate, I understand it is recommended that I persist a reference to its ID and can use the RavenDB client API's Includes to retrieve all the entities efficiently.
That handles the data part, what I haven't seen is the best way to handle this in my entity class:
Thoughts?
Upvotes: 3
Views: 570
Reputation: 26668
In DDD there are at least two valid points of view. Some ppl link root aggregates only by ID or another valid key and second is using platform specific references to other objects. Both has it's own pros and cons.
With NoSql solutions like RavenDb, it's probably better to use first approach, because second is just technically wrong.
Upvotes: 2
Reputation: 22956
You are going explicitly against the recommended design here, why do you want a Product property refering to another aggregate? What does it gives you?
Upvotes: 1