You can put it in application_start()inglobal.asax
I currently have a static method that I call from application_start, which initializes all my mappings. Library.AutoMapping.RegisterMaps();
AutoMapper.Mapper.CreateMap(typeof(CoolObject), typeof(CoolObjectViewModel));
AutoMapper.Mapper.CreateMap<CoolObject, CoolObjectViewModel>()
.ForMember(d => d.Property1, f => f.MapFrom(s => s.Property1))
.ForMember(d => d.Property2, f => f.MapFrom(s => s.Property2))
.ForMember(d => d.Property3, f => f.MapFrom(s => s.Property3));
, . , HomeController IDataContext. IDataContext Ninject RequestScope, DataContext . .
public class HomeController : Controller {
IDataContext dataContext;
public HomeController(IDataContext dataContext) {
this.dataContext = dataContext;
}
}
Ninject http://buildstarted.com/2010/08/24/dependency-injection-with-ninject-moq-and-unit-testing/