I am implementing a WPF based application using MVVM for UI.
I have a viewboard that can be editable for every editable model that contains all the logic to handle error information in VM, "dirty" management and so forth ..
This design supports CRUD schenarios well for simple domain model objects which are anemic , there is no such logic. Now, I am facing a more difficult problem because I have a domain model that has a logic and this argument can change the internal state of the domain model. Has anyone already encountered this scenario? If so, do you have any advice to handle this advice properly? Riyana In this way I usually work with: Videodolal layer is made of types related to this layer, which means that I never use my business object directly within the view model. I see my business objects mapped to modal objects which can reduce the same shape which reduces the behavior. It can be argued that this violation does not repeat itself, but by doing so you will be able to make a single liability theory Can permit to follow. In my opinion, SRP should usually drill ViewModel is present for viewing, and there is a model for the service of business rules / behavior. I create a mask / service layer that takes and gives viewmodels as arguments, but maps viewModels from their respective business object version-and-to. This way, non-anaemic objects will not apply non-visual arguments to the view modal The dependency will look like this: I think it is important to keep this in mind if you want to highlight the full potential of MVVM: Models of view modal view are abstract / not presented to the model. The scene is .
ViewModel & lt; - & gt; Mask / Service Layer - & gt; Business Objects
Comments
Post a Comment