I like getting all my service from the container and I like using AutoMapper. So I added the AutoMapper to the container, a WindsorContainer in this case.

The main interface is IMappingEngine, which is implemented by MappingEngine which also implements IMappingEngineRunner. This contains a getter to an IConfiguration interface which is also an IConfigurationExpression. So to replace Mapper you need an instance of IMappingEngine and then you can configure the engine as follows:

public CustomMapper(IMappingEngine engine)


    engine = engine;</p>


    var runner = </em>engine as IMappingEngineRunner;

    if (runner == null)



    var configuration = runner.Configuration as IConfigurationExpression;

    if (configuration == null)



    configuration.CreateMap<IApplication, B.Application>();



Next setting up the container, the MappingEngine needs an IConfiguration, the Configuration needs some IObjectMapper instances.

private static void RegisterMappingEngine()



                            .FromAssembly(typeof (IObjectMapper).Assembly)

                            .Configure(configurer => configurer.Named(configurer.ServiceType.Name))

                            .Configure(configurer => configurer.LifeStyle.Transient));




















These are all set as Transient because each CustomMapper can be Singleton and I don’t want the mappings to over lap between the CustomMappers.