Enforce invariants spanning multiple aggregates (set validation) in Domain-driven Design
To illustrate the problem we use a simple case: there are two aggregates - Lamp and Socket . The following business rule always must be enforced: Neither a Lamp nor a Socket can be connected more than once at the same time. To provide an appropriate command we conceive a Connector -service with the Connect(Lamp, Socket) -method to plug them. Because we want to comply to the rule that one transaction should involve only one aggregate, it's not advisable to set the association on both aggregates in the Connect -transaction. So we need an intermediate aggregate which symbolizes the Connection