Replies: 1 comment
-
|
Try the MyGet build. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As my understanding and from my previous experience working with AutoMapper, constructor handling should work out of the box as long as the naming & type of the properties match to the constructor parameters, and it does... As long as you don't have to map any custom source expressions.
I found plenty of old posts on SO and others forums that suggest using
ForCtorParambut I was surprised to see that theForCtorParamdoesn't replaceForMemberbut you must specify them both, for each property, which is redundant.I solved it temporary by adding an extension method that adds them both, but would like to get your input whether it's the intended behavior, or rather I'm doing something wrong, or maybe there's a bug in the library.
Source/destination types
Mapping configuration
Version: 10.1.1
Expected behavior
Only
.ForMemberstatement is needed to map a property with matching ctor parameter.Actual behavior
If only
.ForMemberis provided, the following error occurs:If only
.ForCtorParamis provided, the following error occurs:Steps to reproduce
Using Xunit test:
Beta Was this translation helpful? Give feedback.
All reactions