-
-
Notifications
You must be signed in to change notification settings - Fork 194
Description
Is your feature request related to a problem? Please describe.
I have class A with about 70 properties and class B with 29 properties. All properties from class B exist in class A. But I want to map only 10 properties from B to A. Now I'm forced to add 19 [MapperIgnoreSource(nameof(B.Prop1))] attributes to mapper method. With this approach it is simpler to write 10 rows of manual mapping code (a.Prop2 = b.Prop2).
Maybe I'm missing somethiing but didn't find any ability to ignore all props of class with single attribute or something.
Describe the solution you'd like
It will be nice if I be able to add something like this:
[MapperIgnoreSource]
[MapProperty(nameof(B.Prop2), nameof(A.Prop2))]
[MapProperty(nameof(B.Prop3), nameof(A.Prop3))]
public static partial A Map(B b);or one-liner (the best option):
[MapperIgnoreSource(Except=new[]{nameof(B.Prop2), nameof(B.Prop3)})]
public static partial A Map(B b);Describe alternatives you've considered
An alternative is do not use Mapperly and write mapping myself for this cases :(
Additional context
None