Given the following classes:
public class User
{
public int Id {get;set;}
public PersonName Name {get;set;}
}
public class PersonName
{
public string FirstName {get;set;}
public string LastName {get;set;}
}
public class UserDto
{
public int Id {get;set;}
public string FirstName {get;set;}
}
And the following display configuration:
Mapper.CreateMap<User, UserDto>()
.ForMember(destination => destination.FirstName,
options => options.MapFrom(source => source.Name.FirstName))
Is it possible to resolve the name of the source property for this property in the target:
sort of:
Assert.AreEqual(GetSourcePropertyName<User, UserDto>("FirstName"), "Name.FirstName")
source
share