Does anyone know of a comprehensive guide to setting up Automapper with Autofac. I'm new to both but I have played around with the static Mapper class however I want to be able to mock and inject IMappingEngine and create a configuration that sets up all my mappings. All the guides I have looked at so far don't really explain what is going on and I can't quite work it out. Also I am using Autofac 3.0 which seems to have some differences in the ContainerBuilder methods which doesn't help (the reason I'm using it is that Autofac.mvc4 depends on it).
Update:
OK, the simplest solution seems to work well enough, however I had not seen it anywhere on the internet and that maybe for a good reason that I don't know? The simplest thing to do is just to Register the static Mapper.Engine as IMappingEngine and still use the static Mapper.CreateMap to configure in the first place.
var builder = new ContainerBuilder();
builder.Register<IMappingEngine>(c => Mapper.Engine);
Now Autofac can inject the IMappingEngine into your constructors. This does mean that Mapper will handle the IMappingEngine singleton rather than Autofac and Autofac is just acting as a wrapper for it. I would like Autofac to handle the IMappingEngine instance but I'm not sure how?