Ok totally noob question about AutoMapper.
Employee model object.
public class Employee {
public string FirstName { get; set; }
public string LastName { get; set; }
public decimal HourlyRate { get; set; }
public List<string> EmailAddresses { get; set; }
}
Dto object:
public class UpdateEmployeeDetailsDto {
public decimal HourlyRate { get; set; }
public string EmailAddress1 { get; set; }
public string EmailAddress2 { get; set; }
}
I want to map the DTO to the Employee object and turn EmailAddress1 and EmailAddress2 into a List.
I’ve searched for this type of thing on google and SO but the expamples I’ve found I’ve not been able to translate them into working code.
Any help?
Use
AfterMapto provide custom mapping (creation list from properties in your case):