mapping two source props to one target prop #727
-
Hi, I have a requirement to bind/join two source property values to one source
target
I need to join the value of Appreciate your help. |
Beta Was this translation helpful? Give feedback.
Answered by
TimothyMakkison
Sep 5, 2023
Replies: 2 comments 2 replies
-
Hey, thanks for using Mapperly. It looks like before/after mapping could work. [Mapper]
public static partial class Mapper
{
// tell mapperly it doesn't need to resolve Make, we will do it ourselves
[MapperIgnoreTarget(nameof(CarDto.Make))]
private static partial CarDto InternalMapCarToDto(Car car);
public static CarDto MapCarToDto(Car car)
{
var target = InternalMapCarToDto(car);
target.Make = $"Merged {car.Brand} + {car.Model}";
return target;
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
latonz
-
I think
has to change as below
That fix the exception. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, thanks for using Mapperly. It looks like before/after mapping could work.