Aggregations and DDD

2

I'm developing a project by applying the principles of DDD , I created an aggregation class ( Conta ) it will contain the classes ( Agencia ) and ( Agente ) which as ( Conta ) have tables in the database. My question is this:

I would need to create a Repository class and a Service class for each of my entities (Account, Agent and Agency) or should I only create ContaRepository and within it do the insertions and searches of the 3 classes? p>     

asked by anonymous 11.01.2017 / 10:38

1 answer

0

I'm not an expert on the subject but I'm going to try to give a light

  

I would need to create a Repository class and a Service class by   each of my entities (Account, Agent and Agency) or sole must   to create the AccountRepository?

If I understand correctly, the answer is not for the following reason:
"Aggregates gather one or more entities in a single abstraction"
Therefore, a repository by aggregation, that is, only ContaRepository .

How much the creation of service the definition makes clear:
"Services are classes that contain business logic but do not belong to any Entity or Values Objects. "

By the above definition it becomes clear when using ContaService would be required.

  

References:

link link
#

    

21.01.2017 / 02:29