Skip to content
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

ForAllMembers condition breaks after upgrading to 3.1.0 #432

Closed
jameshulse opened this issue Dec 17, 2013 · 1 comment
Closed

ForAllMembers condition breaks after upgrading to 3.1.0 #432

jameshulse opened this issue Dec 17, 2013 · 1 comment
Labels
Milestone

Comments

@jameshulse
Copy link

We just upgraded from 3.0.0 to 3.1.0 and started getting an issue with mappings with the following definition:

.ForAllMembers(o => o.Condition(c => !c.IsSourceValueNull));

This was previously functioning correctly and would not attempt to map properties which did not have a source value. After the upgrade, it seems that Automapper, when faced with a destination member that has no matching source member, will attempt to map from the source type to the destination member. This then throws a mapping exception because there is no mapping definition for the source type to any of the destination property types. Previously, Automapper seemed to rightfully ignore members which did not have a matching source member.

We changed the condition line to:

.ForAllMembers(o => o.Condition(c => c.PropertyMap.SourceMember != null && !c.IsSourceValueNull));

And this fixed the issue. The other solution was to add Ignore() to every single destination property, but this was impractical.

@jbogard jbogard closed this as completed in 5300455 Apr 9, 2014
@jbogard jbogard added the Bug label Apr 15, 2014
@lock
Copy link

lock bot commented May 8, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants