Replies: 2 comments 1 reply
-
AutoMapper already supports implicit and explicit conversion operators with no additional config. What is this adding? |
Beta Was this translation helpful? Give feedback.
1 reply
-
This discussion has been automatically locked since there has not been any recent activity after it was closed. |
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.
-
Hello,
It would be nice if the mapper could take some configuration parts from exiting implicit or explicit conversion operators defined on the type.
The code below is just a simple illustration.
Sourcetypes
Destination types
Mapping configuration
Desired behavior
Ideally Desired behavior
The mapping from TenantEntity to TenantDto could be taken from 'public static Expression<Func> Map(TenantEntity entity)'
The benefit for such addition would be that other parts of the code could still use the natural operator with same logic.
Besides this the configuration could be made completely invisible if all the involved types would provide the mapping in such a way.
It is not necessary to implement from such an interface: 'IMap<TSource, TTarget>' it could be also convention based or attributed.
And the essence of operators is to convert from one type to another or not? Why not to reuse them?
Beta Was this translation helpful? Give feedback.
All reactions