In my implementation I have a service layer to service my Aggregate roots. One of my aggregate roots is an order, to wich I have an OrderService.
For reference, the project is Asp.Net MVC.
On the update order page in the presentation layer a user can update their OrderLines. When the data is posted back to the server these are the actions I am currently taking:
- Calling OrderService.GetOrderById(orderId) to get the order being updated.
- Update the order instance I just received from my OrderService.GetOrderById with the data that was posted from the form in the presentation layer.
- Then I call OrderService.UpdateOrder(IOrder order) with the updated Order instance.
Is this a good/common way of doing things...it seems semi logical and easy to follow on the one hand but also seems as though I might be doing too much by pulling the object out of the repository through the OrderService, and then updating it....and then putting it back. Needless to say I am still finding my way around DDD.
What are your thoughts on this approach?