Derived type map does not use parent ConstructUsing: Destination needs to have a constructor with 0 args or only optional args. #3682
Darthruneis
started this conversation in
NA
Replies: 1 comment 3 replies
-
Beta Was this translation helpful? Give feedback.
3 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.
-
Seems related to/similar to: #1023
Source/destination types
Mapping configuration
Version: 10.0.0
Expected behavior
I would have expected the mappings for ASource -> Destination and BSource -> Destination to utilize the existing constructor call that was defined on Source -> Destination.
Actual behavior
System.ArgumentException
Destination needs to have a constructor with 0 args or only optional args. (Parameter 'type')
Workarounds
Duplicate the ConstructUsing:
Alternatively, change the Destination constructor so that the parameter
a
matches the name of the property:Steps to reproduce
I was using an XUnit test to reproduce this:
The workarounds make me think that this is a bug, as it seems odd that the parameter name would be the root cause of all of this, and that the consequence of it is that you'd have to duplicate the call to
ConstructUsing
in two maps.Beta Was this translation helpful? Give feedback.
All reactions