AutoMapper を使用してクラスをマップしたいだけでなく、ソース パラメーターがマップされないようにしたいと考えています。
public class Dest
{
public string strInclude { get; set; }
}
public class Source
{
public string strInclude { get; set; }
public string strIgnore { get; set; }
}
Mapper.CreateMap<Dest, Source>()
//code to prevent strIgnore from mapping over to Dest
宛先パラメーターを無視する例はたくさんあります。
Mapper.CreateMap<Dest, Source>()
.ForMember(dest => dest.strIgnore, src => src.Ignore());
しかし、私はその逆のケースを見つけることができないようです。