public static FluentlyWindsor.FluentWindsor RegisterMvcControllers(this FluentlyWindsor.FluentWindsor fluentWindsor, System.Web.Mvc.ControllerBuilder controllerBuilder, params string[] controllerNamespaces) { FluentWindsorExtensionsConstants.ControllerNamespaces = controllerNamespaces; ControllerBuilder.Current.SetControllerFactory(new FluentWindsorMvcControllerFactory(FluentlyWindsor.FluentWindsor.ServiceLocator)); return(fluentWindsor.WithTypesInheriting <Controller>( (x, y) => x.RegisterIfNotAlready(Component.For(y).Named(y.Name.Replace("Controller", "_MVC")).LifeStyle.PerWebRequest))); }
public static FluentlyWindsor.FluentWindsor RegisterApiControllers(this FluentlyWindsor.FluentWindsor fluentWindsor, HttpConfiguration configuration) { GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerActivator), new FluentWindsorControllerActivator()); //This method breaks webapi GlobalConfiguration.Configuration.DependencyResolver = new FluentWindsorDependencyResolver(); return(fluentWindsor); //return fluentWindsor.WithTypesInheriting<ApiController>((x, y) => x.RegisterIfNotAlready(Component.For(y).Named(y.Name.Replace("Controller", "_API")).LifeStyle.PerWebRequest)); }