I can either have the data elements in the viewmodel (partial code):
public class PersonViewModel : INotifyPropertyChanged
{
public string FirstName
{
get
{
return firstName;
}
set
{
firstName = value;
OnPropertyChanged("FirstName");
}
}
public string LastName
{
get
{
return lastName;
}
set
{
lastName = value;
OnPropertyChanged("LastName");
}
}
}
or I can wrap them as a DTO inside the view model (partial mode):
public class PersonDTO : INotifyPropertyChanged
{
public string FirstName
{
get { return firstName;}
set
{
firstName = value;
OnPropertyChanged("FirstName");
}
}
public string LastName
{
get { return lastName; }
set
{
lastName = value;
OnPropertyChanged("LastName");
}
}
}
public class PersonViewModel
{
public PersonDTO boundToPerson;
}
which approach is better and why?