I'm new to the whole Automapper world in .net core 3.1 and was going through the docs and SO, but couldnt' find anything for my use case from their latest version 8.0.
Borrowing from another SO post, how could I do this in the new v8.0 configuration?
public class People {
public string FirstName {get;set;}
public string LastName {get;set;}
}
public class Phone {
public string Number {get;set;}
}
Convert to a PeoplePhoneDto like this:
public class PeoplePhoneDto {
public string FirstName {get;set;}
public string LastName {get;set;}
public string PhoneNumber {get;set;}
}
Would I use still do this?
Mapper.CreateMap<People, PeoplePhoneDto>();
Mapper.CreateMap<Phone, PeoplePhoneDto>()
.ForMember(d => d.PhoneNumber, a => a.MapFrom(s => s.Number));