I currently digging into DDD and need a little enlightment.
I have two entities
TempleTempleVariant
Temple (earpiece) contains the base information (name, description,...) and has n variants which have technical descriptions (CAD-drawing, size,...)
My first impression was:
Temple and TempleVariant form an aggregate - they belong together:
They seem very tightly coupled
- if I delete a
TempleallTempleVariants should be deleted likewise TempleVariants cannot exist withoutTemple(at least it makes no sense)
But then I read that nothing outside the aggregate root is allowed to reference an entity inside another aggregate. But actually not Temple is referenced by outside entities but the TempleVariants.
Does this mean that in (DDD) reality Temple and TempleVariant are different aggregates which just seem to be an aggregate?
But then, what if I delete Temple? As I said TempleVariants must also be deleted. But that would then violate the rule "One aggregate-change - one transaction" (or what it is called :)) because my "feeling" is that I would have to delete them in one transaction...
So my questions are:
- are those two aggregates?
- if so: how to handle deletes?
Lg
warappa
TempleVariantto have it's own unique identity? I would instead make its identity relative to its parent, eg.Temple 12345, variant 2. - MattDavey