I'm updating a project to AutoMapper 4.2.0 and am running into some issues while moving away from the static Mapper class. So far, I have everything building properly. I'm a Castle Windsor and Dependency Injection rookie, however, and I can't get the AutoMapper installer working properly. Here's what I've got now:
public class AutoMapperInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component
.For<IMappingEngine>()
.UsingFactoryMethod(cc => Mapper.Engine)
.LifestyleSingleton());
}
}
}
This, of course, gives me the warning that AutoMapper.Mapper.Engine is obsolete. The end result is that several of my unit tests fail, and AutoMapper is not properly installed for dependency injection to work.
What's the proper way to register AutoMapper after the move to 4.2.0?