Where is GetAllTypeMaps and AutoMapper.Impl.PropertyAccessor in version 4?

1.3k Views Asked by At

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?

0

There are 0 best solutions below