-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
GeneratorThis issue focuses on the source generatorThis issue focuses on the source generatorenhancementNew feature or requestNew feature or request
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
GeneratorThis issue focuses on the source generatorThis issue focuses on the source generatorenhancementNew feature or requestNew feature or request