How to bootstrap AutoMapper with Unity?
automapper, dependency-injection, ioc-container, unity-container
Solution
This should work:
container.RegisterType<IMappingEngine>(new InjectionFactory(_ => Mapper.Engine));
Problem
I need to use `Unity` as my DI container and want to bootstrap `AutoMapper`. Using `StructureMap` I can do it like this; ``` For<IMappingEngine>().Use(() => Mapper.Engine); ``` How do I do this in `Unity`? I have used the Package Manager to get hold of the currently newest version of `AutoMapper` 2.2.1-ci9000, but could also use 2.2.0 in case that is simpler. I use version 2.1.505.0 of `Microsoft.Practices.Unity`.