I'm starting to use AutoMapper for my project. For this I want to do the following 'one-to-many' mapping:
Source:
public class Team
{
int Id { get; set; }
string TeamName { get; set; }
List<Person> Member { get; set; }
}
public class Person
{
int Id { get; set; }
string Name { get; set; }
string EyeColor { get; set; }
}
Destination:
public class TeamDetailsViewModel
{
int Id { get; set; }
string TeamName { get; set; }
List<MemberViewModel> Members { get; set; }
}
public class MemeberViewModel
{
int Id { get; set; }
string EyeColor { get; set; }
}
My question is like this question, but I want to map a class instead of List<int>.
How to proceed with AutoMapper? Is this possible?