Navigation Properties - Domain-Driven Design

3

Hello,

I'm studying DDD and I came across the following question:

There is Aggregate , a set of related objects that have an Aggregate Root Aggregate Root / strong>). So far so good, I've created a routine that would generate all the information starting from the Root Aggregate and storing it in the Database.

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

In my scenario the Root Aggregate has associations with three entities, but I wanted to retrieve information from only one of these entities, I believe that finding the Aggregate completely would end up affecting performance because it would result in data that it would not use. I do not know if this is correct or if I misunderstood.

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

    
asked by anonymous 11.06.2017 / 19:29

1 answer

3
  

In my scenario the Root Aggregate has associations with three entities, but I wanted to retrieve information from only one of these entities, I believe that finding the Aggregate completely would end up affecting performance because it would result in data that it would not use. I do not know if this is correct or if I misunderstood.

An AGGREGATE is a group of associated objects that we treat as a unit for data changes .

  

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

Yes, you can create a query with just the data you want, as long as the control of access to the objects within the limit of your aggregation is done by the ROOT entity of the aggregate.

Points of Attention:

  • External objects should only reference the aggregation root

  • Do not allow editing of non-root aggregation data

12.06.2017 / 01:15