/// <summary> /// Container を初期化します /// </summary> private void InitialzieContainer() { GlobalContainer.Initialize(new NinjectContainer()); GlobalContainer.AddInstance(typeof(IApplicationEnvironment), new WebApplicationEnvironment(GetEnvironmentName())); GlobalContainer.AddInstance(typeof(ITypePath), new AutoDetectTypePath(typeof(Startup).Namespace, Assembly.GetExecutingAssembly())); GlobalContainer.AddInstance(typeof(IMailSenderFactory), new SmtpMailSenderFactory()); }
protected void Application_Start() { GlobalConfiguration.Configure(WebApiConfig.Register); MapperConfigurator.Configure(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); GlobalConfiguration.Configuration.Services.Replace( typeof(IHttpControllerActivator), new WindsorApiControllerActivator(GlobalContainer.Container)); // вот тут GlobalContainer.Initialize(new DatabasesInstaller()); GlobalContainer.Initialize(new RepositoriesInstaller()); GlobalContainer.Initialize(new ServicesInstaller()); GlobalContainer.Initialize(new ControllersInstaller(Assembly.GetExecutingAssembly())); var controllerFactory = new WindsorControllerFactory(GlobalContainer.Container.Kernel); ControllerBuilder.Current.SetControllerFactory(controllerFactory); }
private void InitializeContainer() { GlobalContainer.Initialize(new NinjectContainer()); }