I am using AutoMapper in my project along with, NHibernate and ASP.NET MVC 2.
If I have a list of DTOs or a DTO inside the parent DTO that I am mapping to the View Model, should I flatten out the inner DTOs as well ?
Edit
Should I write view model classes for the internal objects as well or should I use them as it is (as DTOs with lazy loading, due to NHibernate)?
When you map an object to object,
AutoMappertrying automatically get all the destination objects properties mapped, including complex properties.You probably want to test that all the properties of the destination object are mapped. You can achieve that with:
About your edit: the ViewModel needs to be entirely dependent on the model object. So internal objects needs to be as well specific to the view model.