Aug 24, 2011 at 10:59 AM
Edited Aug 25, 2011 at 7:16 AM
I have just started looking at using MVC for some upcoming projects. To help me try and understand possible design approaches I have been trying to find sample applications. This is certainly the best example I have come across so far.
I understand the idea behind having a domain model and a separate view model that either exposes the domain model or even re-maps into a new object. What a do find a little confusing in your design is the use of an interface to pass back data changes into
the domain handlers.
An example of this is the UpdateVehicle handler which takes an
ICreateVehicleCommand to pass changed information. You have a view model that implements this interface which contains all the data annotation attributes to perform validations. You also have a VehicleModel in the domain which has the same
validation attributes (the properties of this object are readonly so I’m not sure if they would ever be called into action).
Isn’t this duplicating the business logic and should this logic only exist in the domain model?