New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use CreateMissingTypeMaps option and manual mappings? #2008
Comments
The I'm going to guess mapping overrides are from something like, if not exactly Dynamic Proxies from EntityFramework. What you do is make a conditional mapper map anything that's not dynamic proxies, or make your conditional mapper's where clause more robust to handle anonymous types being mapped better. |
@TylerCarlson1 you guessed right! The problem just comes when EF proxy classes are used. You gave me the right directions and now it is working like a charm. I refactored the AnonymousProfile in order to don't use the Thank you. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have a situation that requires to use CreateMissingTypeMaps and manual mappings at the "same time" (or at least at the same configuration).
Scenario: The Domain and View Model classes are manually mapped using profiles. The CreateMissingTypeMaps property is necessary because I have an anticorruption layer to access a legacy system wich returns anonymous objects.
The issue is that the manual mapping has it's mapping overhidden by CreateMissingTypeMaps option when it is set to true and I can't map anonymous objects when it is false.
I tried to set CreateMissingTypeMaps inside the MapperConfiguration, inside a profile and also inside a profile with a mapping condition but all of them failed.
The code below is my attempt to do a conditional profile that should be applied just for anonymous objects.
The text was updated successfully, but these errors were encountered: