Would it be considered bad practice to have a viewmodel that has a property of another view model?…as in:
public class PersonViewModel
{
public PersonJobViewModel Peron { get; set;}
//other properties here...
}
EDIT
A little more about my particular situation:
I have a view model that currently contains 2 domain classes. I pass this viewmodel to a view that loads 2 partials views(one for each domain class in the viewmodel)
So with this I end up passing pure domain models directly into the partial views.
My thinking is that I can make a view model for each domain model that go to the partials…and then wrap those 2 in another viewmodel that gets passed to my parent…
or is there a better way to accomplish this?
No, it’s not bad at all. It’s perfectly fine code. It allows you to reuse portions of view models between different views.