Aggregations and the DDD

Asked

Viewed 208 times

2

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

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

  • No, you don’t need to create a Repository, but I still have a feeling that you’re not using the Entity Framework. http://answall.com/questions/51536/quando-usar-entity-framework-com-repository-pattern/80696#80696

1 answer

0


I’m no expert on the subject but I’ll try to shed some light

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

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

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

By the above definition it is clear when using the ContaService it would be necessary.

References:

https://www.pluralsight.com/courses/domain-driven-design-in-practice https://github.com/vkhorikov/DddInAction
What is the service layer in DDD?

Browser other questions tagged

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