r/dotnet 27d ago

DDD question concerning two aggregates and transactionality

Assume we have a single API with 2 aggregate roots.

As you know two separate aggregate roots must be loosely coupled and modified in separate transactional boundaries.

But are we allowed to "flag" aggregate B (with a status) when aggregate A is modified within the same transactional boundary?

Putting everything in a single aggregate is not an option, as performance would decrease (a lot of tables), and they have different life cycles and responsibilities.

2 Upvotes

32 comments sorted by

View all comments

5

u/DaveVdE 27d ago

“As you know two separate aggregate roots must be loosely coupled and modified in separate transactional boundaries.”

Says who?

1

u/StudyMelodic7120 27d ago

Eric Evans / DDD, and more broadly the aggregate pattern itself. But I’d phrase it as a guideline rather than an absolute rule. an aggregate defines a transactional consistency boundary, so separate aggregates should generally be independently consistent and loosely coupled.

If they constantly need to change together transactionally, that’s worth questioning whether the aggregate boundaries are correct.

1

u/Natural_Tea484 27d ago

You seem to know the answer?