Ignore property when mapping using MemberList.Source #4119
-
Source/destination typespublic class Dbo
{
public string Name { get; set; }
public string Password { get; set; }
}
public class Dto
{
public string Name { get; set; }
public string Password { get; set; }
} Mapping configurationvar config = new MapperConfiguration(cfg => cfg.CreateMap<Dto, Dbo>(MemberList.Source).ForMember(dst => dst.Password, opt => opt.Ignore()));
config.AssertConfigurationIsValid(); Version: 12.0.0Expected behaviorIn previous versions this mapping worked as I expected. Actual behaviorIn version 12.0.0 this mapping fails with the following exception
Steps to reproduceconfig.AssertConfigurationIsValid(); If I add |
Beta Was this translation helpful? Give feedback.
Answered by
lbargaoanu
Oct 24, 2022
Replies: 1 comment 3 replies
-
The new behaviour makes perfect sense to me. The source member is not mapped anymore because you ignored the matching destination member. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
jenscski
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The new behaviour makes perfect sense to me. The source member is not mapped anymore because you ignored the matching destination member.