- If I have to fetch an entity from another Bounded Context in order to map it to something in this Bounded Context, how would I go about doing that?
- Do I call the foreign Bounded Context's Application Layer? Perhaps I need a new "Query" Application Layer for such queries?
- Do I call foreign Bounded Context's repositories?
- Do I call foreign Bounded Context's Domain model directly?
Domain model (please note two separate Bounded Contexts):
CustomerContext.Customer- this is the complete Customer model.
ConsentContext.Person- a scaled-down, heavily transformed version of multiple instances of
CustomerContext.Customer. Rules guiding this transformation reside in
Personnever references ˙Customer` directly, no dependency here.
- Please note: these two entities most definitely belong to separate Bounded Contexts. Customer is what the business works with on a daily basis. Consent Person is heavily transformed due to legal and business requirements and has a different structure altogether. Customer is merely a data source, so Person can create itself using internal business logic.
ConsentContext.ApplicationService- implements use cases. As part of those use cases it fetches
ConsentContext.PersonRepositoryhas to get in touch with the
CustomerContextand retrieve the
CustomerContext.Customerand map to a new Person. This is where I am coming up short - what do I call from here?
CustomerContext's Application Layer?
CustomerContext's Domain model directly?
- Both Bounded Contexts run in the same process, I am not using a REST API.
- I am targeting Customer/Supplier relationship.