I'm having some difficulty figuring out how the Aggregate Root will track changes on child entities.
Let say I have an aggregate:
- Order (root)
- OrderLineItem
With the Order
class being the aggregate root. How will I track the changes made on each of the OrderLineItem
through the Order
class?
When I make a repository (implementing) e.g. an OrderRepository
(because only the aggregate root can have the repository right?), how will my OrderRepository
track the changes of each OrderLineItem
?
Example:
- Newly added but not committed to DB
- Edited but committed to DB
- Edited but not committed to DB
How do you guys deal with this?