1

I know I can ignore a property when creating the map like this

CreateMap<ClaimExposure, ClaimExposure>();
   .ForMember(x => x.Claim, opt => opt.Ignore())

but that's not what I'm looking for, I'm looking for a way I can do it when I map like this

_mapper.Map(claimExposureDto, claimExposure, opt => opt. ??)

And it only applies to this mapping instance. Is this possible?

chuckd
  • 13,460
  • 29
  • 152
  • 331
  • http://docs.automapper.org/en/latest/Conditional-mapping.html – Lucian Bargaoanu Jan 31 '20 at 05:14
  • Does this answer your question? [C# AutoMapper Conditional Mapping based upon target value](https://stackoverflow.com/questions/24359634/c-sharp-automapper-conditional-mapping-based-upon-target-value) – stasiaks Jan 31 '20 at 08:30
  • No it doesn't! Re read my post please! – chuckd Feb 01 '20 at 18:58
  • The answer [HERE](https://stackoverflow.com/questions/34859214/how-to-ignore-a-property-based-on-a-runtime-condition) from Aaron Wynn fixed this issue for me. – Post Impatica Apr 05 '23 at 16:27

0 Answers0