3

Trying to upgrade from 3.2 to 4.2 automapper and I need help in figuring where GetAllTypeMaps has been moved, or how to do following. I was grabbing all maps and finding the ones that are of type "Command" and ignoring "DateCreated". Here is the code:

 private void IgnoreDateCreateForAllCommands()
        {
            foreach (var map in Mapper.GetAllTypeMaps())
            {
                if (typeof(Command).IsAssignableFrom(map.DestinationType))
                {
                    var propInfo = map.DestinationType.GetProperty("DateCreated");
                    if (propInfo != null)
                    {
                        map.FindOrCreatePropertyMapFor(new AutoMapper.Impl.PropertyAccessor(propInfo)).Ignore();
                    }
                }
            }
        }

I am assuming that there is probably easier way to do this now in 4.2?

epitka
  • 17,275
  • 20
  • 88
  • 141
  • 1
    did you find out about the PropertyAccessor? GetAllTypeMaps is gettable by `mapper.ConfigurationProvider.GetAllTypeMaps()` – Master Azazel Jan 13 '17 at 16:43

0 Answers0