Custom mapping form string to enum #3645
-
Source/destination typesSource: string "mobile-app-android" or "mobile-app-ios" or "web" Destiantion: eum
Mapping configurationCreateMap<string, RegisterMethodTypes>()
.ConstructUsing((strValue) => MapPlatform(strValue));
Version: x.y.z10.1.1 Expected behavior"ConstructUsing" should be called and exception from "MapPlatform" method should be thrown:
"ConstructUsing" should be called and "MapPlatform" method will map the value:
Actual behavior
Mapping config is not triggered at all. I should get exception from "MapPlatform" but this method is not triggered. Automapper is using some strange default behavior. |
Beta Was this translation helpful? Give feedback.
Answered by
lbargaoanu
May 12, 2021
Replies: 1 comment
Answer selected by
lbargaoanu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.enummemberattribute?view=net-5.0