Describe the solution you'd like:
At the moment the only way to manually map a member is using the ForMember<T1, T2>(TargetProp) attribute.
[GenerateMapper]
[Map<User, UserDto>]
public partial class UserMapper
{
[ForMember<User, UserDto>(nameof(UserDto.DayOfBirth))]
public static int GetDayOfBirth(User source) => source.DateOfBirth.UtcDateTime.Day;
}
This can be simplified for simple property assignments so that they dont need to call a method. A signiture like ForMember<T1, T2>(SourceProp, TargetProp) would probably work.
[GenerateMapper]
[Map<User, UserDto>]
[ForMember<User, UserDto>(nameof(source.DateOfBirth.UtcDateTime.Day), nameof(UserDto.DayOfBirth))]
public partial class UserMapper;
Only issue is nameof() will return the name of the final property not the whole expression.
Describe the solution you'd like:
At the moment the only way to manually map a member is using the
ForMember<T1, T2>(TargetProp)attribute.This can be simplified for simple property assignments so that they dont need to call a method. A signiture like
ForMember<T1, T2>(SourceProp, TargetProp)would probably work.Only issue is nameof() will return the name of the final property not the whole expression.