As far as I understand, using view models can do web developers. life is much simpler, in the sense that we can use this approach to display only the necessary properties in localized strings. I also use mvc3 validation to view jquery etc.
Now I doubt it, since I have a real bottleneck in my webapp. requesting all objects (20 of them) like this
List<Domain.Property> data = session.Query<Domain.Property>().ToList();
return PropertyViewModel.FromDomainModel(data);
and this list of property objects is sent to my ViewModel, where FromDomainModel is located, which expects Object List objects like this
List<PropertyViewModel> dataVm = new List<PropertyViewModel>();
{
foreach (Property p in x)
{
dataVm.Add(new PropertyViewModel(p));
}
return dataVm;
}
now in the same class i use
public PropertyViewModel(Property x)
{
Id = x.Id;
Created = x.Created;
Title = x.Title;
....
Photo = x.Photos.First();
}
, viewmodel, viewmodel , , ( ). , .
. .
, , , , .
Update:
20Entities, , , 67 , .