Domain Services with multiple Aggregate Operations #144
Unanswered
nilaxann65
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I would just create a query in an Article module that exposes the data that you need and call it from the service that needs that data.
If that service creates a Note, it probably should be in the Note domain (and call Article -> GetPrice query) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following issue: I'm working on an inventory system where I have two aggregates, Note and Article. A Note has a list of lots associated with it, and Article is a single aggregate, without child entities.
Here is the problem:
When I create a new Note with many lots (which could be from different articles), I need to calculate the total price. However, the prices of the articles are in the Article aggregate, so I can't access that data directly. For this, I could create a domain service that fetches the data from both articles and calculates the total price. But where should I declare this domain service? The aggregates and services are in different modules. Maybe I'm going the wrong way. I would like to know your opinions :).
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions