MVVM View DTO Model

I have a WCF based application that uses services to access server-side repositories. I pass the DTO from the server to the client and wonder how best to make the DTO pf part a view model.

I have a simple example of simple properties in a view model, but he did not know how to handle real DTO objects and any possible conversion between the properties of the DTO model and Vview.

+4
source share
2 answers

Your question is very general, but the template usually looks something like this:

public class CustomerViewModel : ViewModel { private readonly CustomerDTO _customer; ... public string Name { get { return _customer.Name; } set { if (_customer.Name != value) { _customer.Name = value; OnPropertyChanged(() => this.Name); } } } } 

You need to ask a more specific question if that doesn't make any sense.

+3
source

I am actually developing a library to map my dtos to your view models and your view models in your opinion. You can check it out at http://fluentviewmodel.codeplex.com/

+1
source

Source: https://habr.com/ru/post/1299902/


All Articles