public void Install(IWindsorContainer container, IConfigurationStore store) { var hubs = new List <Type>(); foreach (Assembly assembly in _assemblies) { container.Register( Classes.FromAssembly(assembly) .BasedOn <IHub>() .Unless(x => { if (_removeHubs.Contains(x)) { return(true); } hubs.Add(x); return(false); }) .WithServiceSelf() .LifestyleTransient()); container.Register( Classes.FromAssembly(assembly) .BasedOn <IHubPipelineModule>() .Unless(_removePipelines.Contains) .WithService.FromInterface()); } IWindsorInstaller installer = Installer .Instance <IHubsProvider>(new SignalRHubs(hubs.ToArray())); container.Install(installer); }
public static void StartServiceAndRunForever([NotNull] IWindsorInstaller installer, [NotNull] string serviceName) { StartService(installer, serviceName, false); }
public static void StartServiceAndWaitForKey([NotNull] IWindsorInstaller installer, [NotNull] string serviceName) { StartService(installer, serviceName, true); }
public void Setup() { try { m_Container = new WindsorContainer(); m_Container.Register(Component.For <IConsole>() .ImplementedBy <ConsoleForTesting>() .LifestyleSingleton()); var installers = new IWindsorInstaller[] { new Selkie.Windsor.Installer(), new Interfaces.Installer(), new Installer() }; m_Container.Install(installers); m_Console = ( ConsoleForTesting )m_Container.Resolve <IConsole>(); Sut = m_Container.Resolve <IGame>(); } catch (Exception ex) { System.Console.WriteLine(ex.Message); System.Console.WriteLine(ex.StackTrace); throw; } }
static IWindsorContainer Container(IWindsorInstaller installer) { var container = new WindsorContainer(); container.Install(installer); return container; }
/// <summary> /// Validates all the registered services/dependencies in an installer can be resolved, and throws a detailed /// exception with missing dependencies or other issues preventing resolution of dependencies. /// </summary> /// <param name="installer">An IWindsorInstaller to validate</param> public static async Task ValidateAllDependenciesResolvableAsync(this IWindsorInstaller installer) { using (var container = new WindsorContainer().Install(installer)) { await container.ValidateAllDependenciesResolvableAsync().ConfigureAwait(false); } }
private void AddDependencies(Type type, IWindsorInstaller instance, Dictionary <Type, IWindsorInstaller> currentInstallers) { if (currentInstallers.ContainsKey(type)) { return; } currentInstallers[type] = instance; var dependencies = type.GetAttribute <InstallerDependsOnAttribute>()?.InstallerTypes; if (dependencies == null) { return; } foreach (var d in dependencies) { if (!typeof(IWindsorInstaller).IsAssignableFrom(d)) { throw new Exception($"{d} does not implement IWindsorInstaller. It cannot be installed"); } AddDependencies(d, Activator.CreateInstance(d) as IWindsorInstaller, currentInstallers); } }
public void SetUp() { container = new WindsorContainer(); installer = new AppInstaller(); container.Install(installer); }
public static void Initialize(IWindsorInstaller installer) { if (installer != null) { Container.Install(installer); } }
public static IMockBuilder <TService> IntegrationTest <TService>(IWindsorInstaller windsorInstaller) where TService : class { var testBuilder = new MockBuilder <TService>(windsorInstaller); return(testBuilder); }
/// <summary> /// Add installer /// </summary> /// <param name="installer"></param> public void AddControllerInstaller(IWindsorInstaller installer) { if (ControllerInstallers == null) { ControllerInstallers = new List <IWindsorInstaller>(); } ControllerInstallers.Add(installer); }
/// <summary> /// Creates a new Windsor container based on installers from the parameter /// </summary> /// <param name="installers">The installers to pass to the container</param> public static IWindsorContainer CreateWithInstallers(IWindsorInstaller[] installers) { var windsorContainer = CreateContainer(); windsorContainer.Install(installers); return windsorContainer; }
/// <summary> /// Add web api installers /// </summary> /// <param name="installer"></param> public void AddWebApiControllerInstaller(IWindsorInstaller installer) { if (WebApiControllerInstallers == null) { WebApiControllerInstallers = new List <IWindsorInstaller>(); } WebApiControllerInstallers.Add(installer); }
public ServiceProgram([NotNull] IWindsorContainer container, [NotNull] IWindsorInstaller installer) { m_Container = container; m_Container.Install(installer); m_Logger = container.Resolve <ILogger>(); m_ServiceConsole = container.Resolve <IServiceConsole>(); }
public Example(IWindsorContainer container, IWindsorInstaller installer) { m_Container = container; m_Container.Install(installer); m_Bus = m_Container.Resolve <ISelkieBus>(); m_Logger = m_Container.Resolve <ILogger>(); }
public static IMockBuilder <TService> IntegrationTest <TService>(IWindsorInstaller windsorInstaller, params ITestDependency[] testDependencies) where TService : class { var testBuilder = new MockBuilder <TService>(windsorInstaller); testBuilder.AddTestDependencies(testDependencies); return(testBuilder); }
public static IMockBuilder <TService> IntegrationTest <TService>(IWindsorInstaller windsorInstaller, Action <IIntegrationTestBuilderOf <TService> > func) where TService : class { var testBuilder = new MockBuilder <TService>(windsorInstaller); func.Invoke(testBuilder); return(testBuilder); }
public virtual void Application_Start() { IWindsorInstaller windsorInstaller = FromAssembly.Instance(Assembly.GetCallingAssembly()); _container.Install(windsorInstaller); System.Web.Mvc.DependencyResolver.SetResolver(new WindsorDependencyResolver(System.Web.Mvc.DependencyResolver.Current, _container.Kernel)); GlobalFilters.Filters.Add(new NHibernateSessionPerRequestFilter()); }
public static void BootstrapContainer() { var installers = new IWindsorInstaller[] { new DALInstaller(), new ServiceInstaller(), new ControllerInstaller() }; Container = new WindsorContainer().Install(installers); }
public SitecoreInstaller(Config config) { Config = config; DataMapperInstaller = new DataMapperInstaller(config); QueryParameterInstaller = new QueryParameterInstaller(config); DataMapperTaskInstaller = new DataMapperTaskInstaller(config); ConfigurationResolverTaskInstaller = new ConfigurationResolverTaskInstaller(config); ObjectionConstructionTaskInstaller = new ObjectionConstructionTaskInstaller(config); ObjectSavingTaskInstaller = new ObjectSavingTaskInstaller(config); }
/// <summary> /// Initializes a new instance of the <see cref="SitecoreInstaller"/> class. /// </summary> /// <param name="config">The config.</param> public SitecoreInstaller(Config config) { Config = config; DataMapperInstaller = new DataMapperInstaller(config); QueryParameterInstaller = new QueryParameterInstaller(config); DataMapperTaskInstaller = new DataMapperTaskInstaller(config); ConfigurationResolverTaskInstaller = new ConfigurationResolverTaskInstaller(config); ObjectionConstructionTaskInstaller = new ObjectionConstructionTaskInstaller(config); ObjectSavingTaskInstaller = new ObjectSavingTaskInstaller(config); }
public static IWindsorContainer Install() { IWindsorInstaller[] windsorInstallers = new IWindsorInstaller[] { new AggregateInstaller() }; _container = new WindsorContainer().AddFacility <TypedFactoryFacility>(); return(_container.Install(windsorInstallers)); }
public ElasticClustersConfiguration DefaultConnection(Connection connection) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } _defaultConnection = new ElasticClusterInstaller(new DefaultConnection(connection)); return(this); }
public RedisClientConfiguration DefaultConnection(Connection connection) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } _defaultConnection = new RedisClientInstaller(new DefaultConnection(connection)); return(this); }
public AzureBlobStorageConfiguration DefaultConnection(ConnectionString connectionString) { if (connectionString == null) { throw new ArgumentNullException(nameof(connectionString)); } _defaultConnection = new AzureBlobStorageInstaller(new DefaultConnection(connectionString)); return(this); }
public AzureServiceBusConfiguration DefaultConnection(Connection connection) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } _defaultConnection = new AzureServiceBusInstaller(new DefaultConnection(connection)); return(this); }
public MongoDbConfiguration DefaultConnection(ConnectionString connectionString) { if (connectionString == null) { throw new ArgumentNullException(nameof(connectionString)); } _defaultConnection = new MongoDbInstaller(new DefaultConnection(connectionString)); return(this); }
public SerilogConfiguration DefaultLogger(Logger logger, bool setGlobalStaticLogger = true) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } _defaultConnection = new SerilogLoggerInstaller( new DefaultLogger(logger, setGlobalStaticLogger)); return(this); }
public SerilogConfiguration DefaultLogger(Func <IKernel, ILogger> factory, bool setGlobalStaticLogger = true) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } _defaultConnection = new SerilogLoggerInstaller( new DefaultLogger(factory, setGlobalStaticLogger)); return(this); }
public void Setup(IWindsorInstaller controllerProjectInstaller) { Container.Install(FromAssembly.Containing<MediatorInstaller>()); Container.Install(controllerProjectInstaller); Container.Register( Component.For<DbContext>() .ImplementedBy<ResourcePlanningDbContext>() .DependsOn(Dependency.OnValue<string>("ResourcePlanningDatabaseConnectionString")) .LifestylePerWebRequest() ); }
public void Setup(IWindsorInstaller controllerProjectInstaller) { Container.Install(FromAssembly.Containing <MediatorInstaller>()); Container.Install(controllerProjectInstaller); Container.Register( Component.For <DbContext>() .ImplementedBy <ResourcePlanningDbContext>() .DependsOn(Dependency.OnValue <string>("ResourcePlanningDatabaseConnectionString")) .LifestylePerWebRequest() ); }
private static IWindsorContainer Register() { IWindsorInstaller[] installers = new IWindsorInstaller[] { new AutoMapperInstaller(), new RepositoryInstaller(connectionString), new BusinessServiceInstaller() }; _container = new WindsorContainer().AddFacility <TypedFactoryFacility>(); return(_container.Install(installers)); }
private static void StartOnlyOneService([NotNull] IWindsorInstaller installer, [NotNull] string serviceName, bool isWaitForKey) { using (new OneServiceOnly(serviceName)) { var program = new ServiceProgram(Container, installer); program.Main(isWaitForKey); } }
public static void Init(IWindsorInstaller installer = null) { Container.Register(Component.For <IAdvertService>().ImplementedBy <AdvertService>().LifeStyle.HybridPerWebRequestScoped()); Container.Register(Component.For(typeof(IRepository <>)).ImplementedBy(typeof(RepositoryBase <>)).LifeStyle.HybridPerWebRequestScoped()); Container.Install(new EntityFrameworkInstaller()); Container.Register(Component.For(typeof(IApplicationUserService)).ImplementedBy <ApplicationUserService>().LifestylePerWebRequest()); Container.Register(Component.For(typeof(IDataSession)).ImplementedBy <EntityDataSession>().LifeStyle.HybridPerWebRequestScoped()); if (installer != null) { Container.Install(installer); } }
public AutoMockRepository() { Container = new WindsorContainer(); Container.Register(Component.For <LazyComponentAutoMocker>()); var installers = new IWindsorInstaller[] { new Selkie.Windsor.Installer(), new Interfaces.Installer(), }; Container.Install(installers); }
public void Initialize() { IWindsorInstaller[] castleCompanents = new IWindsorInstaller[] { new InterceptorInstaller(), new ServiceInstaller(), new RepoInstaller(), new AggregateInstaller() }; _windsorCompanents = new WindsorContainer().AddFacility <TypedFactoryFacility>(); _windsorCompanents.Install(castleCompanents); }
public void Initialize() { Container = new WindsorContainer("Config/Windsor.xml"); var defaultInstallers = new IWindsorInstaller[] { new InfrastructureInstaller() }; var installers = defaultInstallers.Concat(GetInstallers()).ToArray(); Container.Install(installers); }
public void Initialize() { var root = WhereAmI(GetType().Assembly); var configPath = Path.Combine(root, "Configuration/Windsor.xml"); Container = new WindsorContainer(configPath); var defaultInstallers = new IWindsorInstaller[] { new InfrastructureInstaller(LogFileName), }; var installers = defaultInstallers.Concat(GetInstallers()).ToArray(); Container.Install(installers); }
public void Add(IWindsorInstaller instance) { installers.Add(instance); }
public WebServiceInstaller(IWindsorInstaller inner) { _inner = inner; }
public void SetUp() { installer = new Installer(); container = new WindsorContainer(); installer.Install(container, null); }
public void Setup() { m_container = new WindsorContainer(); m_propertySubSystemInstaller = PropertiesSubSystem.FromAppConfig(); m_container.Install(m_propertySubSystemInstaller); }
public Bootstrapper RegisterInstaller(IWindsorInstaller windsorInstaller) { _container.Install(windsorInstaller); return this; }