Say I have this class:
public class Account
{
public int AccountID { get; set; }
public Enterprise Enterprise { get; set; }
public List<User> UserList { get; set; }
}
When I use AutoMapper to map the Account class, I would also like it to map the Enterprise class, and the list of users (UserList) in the returned object. How can I get AutoMapper to do this?
Thanks!
AutoMapper does that out of-the-box if you provide a configuration for the Enterprise and User type.
Configuration looks like this:
This shows how to how collections get mapped:
http://automapper.codeplex.com/wikipage?title=Lists%20and%20Arrays&referringTitle=Home