0

Automapper contains built-in functionality to convert from a Dictionary<string, object> to a concrete type. I need to preserve this functionality but append some logic in AfterMap. I cannot call CreateMap because that takes away the built-in functionality.

I also cannot create an inner mapper because I need other converters already defined.

I need it inside the MapperConfiguraton. I cannot get access to what I need outside of the MapperConfiguration, so I cannot define it on the final Map call.

In my attempts, this seems to be impossible but hopefully someone can prove me wrong and knows how to do it.

Arrow_Raider
  • 380
  • 3
  • 6
  • You cannot do that at config time, but you can do it at `Map` time. See https://docs.automapper.org/en/latest/Before-and-after-map-actions.html. – Lucian Bargaoanu Nov 28 '20 at 06:07
  • You might be able to create the mapping with a ConstructUsing and have that map the type from a dynamic instance of the dictionary. That way it'd still use the default object mapper from dynamic, and you can apply your AfterMap on top of it. Definitely seems like a major hack though – devNull Nov 28 '20 at 06:38

0 Answers0