Composition question
Mauro Servienti <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <8c315146adfa472aac1c989b6f4ff538@AMSPR03MB114.eurprd03.prod.outlook.com> |
Hi all, I have 2 different bounded context: "Contacts" and "Expenses Accounts", the second "depends" on the first in the sense that an expense is in favor of a contact or done by a contact. I need to be able to satisfy the following requirements: - As a user I want to be able to add a new expense using an existing contact; - As a user I want to be able to add a new expense for a non-existing contact creating the contact in-line with the expense; In the current implementation I'm not interested in having autonomous services that would be the easiest solution but complicates the deployment at the moment (long story). Service UI Composition I've currently implemented this one, basically in the "create new expense" UI the "search contacts" capability interacts directly with Contacts services and retrieves a de-normalized reference to a contact, reference that is stored within the new expense itself. When the user is satisfied with the data can submit the SubmitNewExpenseCommand, easy peasy. If the contact does not exists the expenses BC can pop up *its own* UI to create a new contact, the contact is created *only* on the client side and then a SubmitNewExpenseWithNewContactCommand (this is not the real name :-P) message is delivered, on the server a new Saga is started to coordinate the contact creation and the expense submission. It works as expected, but I feel that I am giving to many responsibilities to the UI. I'm looking for advices, comments, suggestions, whatever :-) .m