Doubt Model Service DDD

2

I have a question about a project that follows the DDD architecture model.

In a model service I need an information that is the result of a method of another service, what is the correct way to get this information, I create a property of this service and put it in the constructor to do the dependency injection or should I get this information in the previous layer, the same one that I call that first service and pass that value as parameter?

My question is given because I created the second service property and did the dependency injection but then it gave error pq says that there are cyclic dependency injection references and I need to remove the property of that second service and the dependency injection.

    
asked by anonymous 25.01.2016 / 19:26

1 answer

0

It's hard to answer without knowing the context, but I'll try.

If the two services depend on each other, I advise you to create a third service that injects the first two and bridges them.

Example:

Alpha_Service - > UM_Type (BulkService)

Service_Beta - > Two_Type (Alpha_Service)

Delta Service - > Get Alpha and Beta by DI.

Delta Service - > Three-Way () - > Run the Alpha operation by passing Beta as a parameter.

Delta Service - > Fourth Method () - > Run the operation in Beta, passing Alpha as a parameter.

    
20.04.2018 / 16:14