Automapper: passing parameter to Map method
I'm using Automapper in a project and I need to dynamically valorize a field of my destination object. In my configuration I have something similar: cfg.CreateMap<Message, MessageDto>() // ... .ForMember(dest => dest.Timestamp, opt => opt.MapFrom(src => src.SentTime.AddMinutes(someValue))) //... ; The someValue in the configuration code is a parameter that I need to pass at runtime to the mapper and is not a field of the source object. Is there a way to achieve this? Something like this: Mapper.Map<MessageDto>(msg, someValue)); You can't do exactly what you want, but you can get pretty close