public static void ConfigureWindsor(string assemblyName, HttpConfiguration configuration) { var container = new WindsorContainer(); var dependencyInstaller = new DependencyInstaller(); dependencyInstaller.Install(container, null); var apiInstaller = new ApiControllerInstaller(assemblyName); apiInstaller.Install(container, null); container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel, true)); var dependencyResolver = new ApiResolver(container); configuration.DependencyResolver = dependencyResolver; var installerValidators = new ValidatorsInstaller(); installerValidators.Install(container, null); var servicesInstaller = new ServiceInstaller(); servicesInstaller.Install(container, null); FluentValidationModelValidatorProvider.Configure(provider => { provider.ValidatorFactory = container.Resolve <IValidatorFactory>(); }); }
public static void Setup(string assemblyName) { var container = new WindsorContainer(); var installer = new ControllersInstaller(assemblyName); installer.Install(container, null); container.Register(Component.For <IWindsorContainer>()); var installerValidators = new ValidatorsInstaller(); installerValidators.Install(container, null); var dependencyInstaller = new DependencyInstaller(); dependencyInstaller.Install(container, null); var servicesInstaller = new ServiceInstaller(); servicesInstaller.Install(container, null); var controllerFactory = new WindsorControllerFactory(container.Kernel); ControllerBuilder.Current.SetControllerFactory(controllerFactory); FluentValidationModelValidatorProvider.Configure(provider => { provider.ValidatorFactory = container.Resolve <IValidatorFactory>(); }); }