opt.Condition is giving strange results

142 views
Skip to first unread message

JP

unread,
Mar 2, 2012, 10:23:06 AM3/2/12
to AutoMapper-users
Hi,

In my mappings, I'm using

Mapper.CreateMap<TSource, TDestination>()
.ForAllMembers(opt => opt.Condition(src => !
src.IsSourceValueNull));

in order to ignore null values. This worked fine in AutoMapper version
2.0.0.32.

However, something seems to have changed in 2.1. When I break on the
src => !src.IsSourceValueNull expression, I can see that the src
properties are null, which makes IsSourceValueNull == true. The
TSource object that is being mapped does have correct values, so there
seems to be a problem with this.

When I delete the .ForAllMembers clause altogether, the mapping does
happen correctly.

Any idea as to why this seems to have changed? Did something break, or
is a different approach required? Thanks for any info.

Jimmy Bogard

unread,
Mar 26, 2012, 9:39:23 AM3/26/12
to automapp...@googlegroups.com
Hmm this looks like a bug, can you create an issue on GitHub for this?

Thanks,

Jimmy


--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To post to this group, send email to automapp...@googlegroups.com.
To unsubscribe from this group, send email to automapper-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/automapper-users?hl=en.


Reply all
Reply to author
Forward
0 new messages