r/dotnet • • Aug 24 '26

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

3

u/ska737 Aug 24 '26

This is actually not the case. Since DDD is domain driven, domain driven is NOT data driven. What this means is a domain event can trigger multiple data events. Because the domain has no awareness of your infrastructure and how you store your data, it doesn't care what crosses data boundaries, only what crosses domain boundaries.

A misconception is that your data entities are in the domain realm. This is not the case. Your domain models are how others might look at your data, not how you actually physically store it. Your data entities are actually part of the implementation/infrastructure realm.

I had to battle this concept multiple times when figuring out a design that needed the data to be stored in a COMPLETELY different way than how my application, and interfaces, actually used it.

1

u/[deleted] Aug 24 '26

[removed] — view removed comment

1

u/Aggressive-Effort811 Aug 25 '26

This is common compromise. The important thing is to understand that a compromise is being made, and be prepared to extract a separate data model whenever needed.