protected void Application_Start() { ScrumerInitializationHandler.Initialize(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var mapper = MapperProvider.Initialize().CreateMapper(); // Dependency injection: var builder = new ContainerBuilder(); builder.RegisterControllers(typeof(MvcApplication).Assembly); // Register types: builder.RegisterType <ScrumerContext>() .AsSelf() .InstancePerLifetimeScope(); builder.RegisterInstance(mapper); var container = builder.Build(); // Register resolver for asp.net mvc: DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); }