I have AutoMapper mappings, which look like this:
Mapper.Initialize(cfg =>
{
cfg.CreateMap<Person, PersonViewModel>();
cfg.CreateMap<Order, OrderViewModel>();
});
I am trying to figure out where to put this code in an MVC application. There are two options:
1) Composition Root
public class CompositionRoot : IWindsorInstaller
{
//Castle Windosr configuration goes here
//Call to AutoMapper configuration class here
}
2) Global.asax
Questions like this suggest it: Where to place AutoMapper.CreateMaps?
My gut is telling me to put it in the Composition Root, however everywhere I read tells me to put it in the Global.asax.