AutoMapper 11: Map from method by convention? #3913
-
Prior to AutoMapper 11 it was possible to map from a method in the source class to a property on the destination if it followed naming conventions. In the following example
This mapping from methods also seemed to take precedence over properties. In if there was a property that would be mapped and also a matching method, the method would be used over the property. In the following example
This behaviour seems to have been removed from AutoMapper 11. I'm not sure what this feature is called but I cannot see any obvious reference to it on the upgrade guide (https://docs.automapper.org/en/latest/11.0-Upgrade-Guide.html). Is there a way to re-enable it in AutoMapper 11? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Multiple matches are a terrible way to use AM :) So, really, just rename stuff. |
Beta Was this translation helpful? Give feedback.
Multiple matches are a terrible way to use AM :) So, really, just rename stuff.
That being said, properties are supposed to be prefered. So you need a
MapFrom
in your case.