Please can any one advise how to use conditional mapping in AutoMapper to map a value in the TARGET object from a SOURCE object based upon an existing TARGET property value?
Try this:
Mapper.CreateMap() .ForMember( destination => destination.Nickname, option => { option.Condition(rc => { var profileViewModel = (ProfileViewModel)rc.InstanceCache.First().Value; return profileViewModel.NicknameIsVisible; }); option.MapFrom(source => source.Nickname); } );