Navigation Properties - Domain-Driven Design

Asked

Viewed 84 times

3

Hello,

I am studying DDD and came across the following question:

There is the Aggregate (Aggregate), a set of related objects that have an Aggregation Root (Aggregate Root). So far so good, I created a routine that generates all the information from the Root Aggregate and storing in the Database.

I need to retrieve the information from that aggregate, I saw that in Eric Evans' blue book he implied that to recover the Aggregate it is necessary to include all the information related to it.

In my scenario the Aggregate Root has associations with three entities, but wanted to recover the information of only one of these entities, I believe that to search the Aggregate in a complete way would end up affecting the performance, because it would result in data that would not use. I don’t know if this is right or if I misunderstood.

Doubt: it is valid to return only one information from within that aggregate without having to search the Aggregate completely (with all the information) ?

1 answer

3


In my scenario the Aggregate Root has associations with three entities, but wanted to recover the information of only one of these entities, I believe that to search the Aggregate in a complete way would end up affecting the performance, because it would result in data that would not use. I don’t know if this is right or if I misunderstood.

A CLUSTER is a group of associated objects that we treat as a unit for the purpose of data changes.

Doubt: it is valid to return only one information from within this aggregate without having to search the Aggregate completely (with all the information) ?

Yes, you can create a query with only the desired data, provided that the control of the access to the objects within the limit of your aggregation is done by the entity ROOT of the aggregate.

Points of attention:

  • External objects should refer only to the root of the aggregation

  • Do not allow editing of aggregation data that does not pass through the root

Browser other questions tagged

You are not signed in. Login or sign up in order to post.