I'm a novice with domain driven design and learning to apply it in my current project. I hope some of you guys have already walked the path and can help me out.
I have a question with regard to saving UI changes back to an Entity (Order).
The scenario:
a. An approver opens the Order (Aggregate root) pending approval on the Web. Makes some changes and clicks the button "Approve". b. The UI translates the Order changes to a DTO and posts it across to a Web service for processing.开发者_JAVA百科 c. The service pulls the Order from OrderRepository via say call to orderRep.GetByID(ApplicationNumber)Question
1. How do I post the UI changes available in the OrderDTO to Order? 2. What are the different things I need to take care while hydrating the Order? (If we have to ensure that the domain object (Order) doesn't land up in invalid state due to changes)Each user operation should correspond to a different command method in the application service layer. Much of the time it will correspond to exactly one call on a domain object.
You probably don't have fine-grained enough methods on your Order domain object.
Approve()
should probably only be a method, not a public setter. Throw an exception within Approve()
if it would place the Order
object in an invalid state.
精彩评论