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);
        }
Пример #2
0
 public static void StartServiceAndRunForever([NotNull] IWindsorInstaller installer,
                                              [NotNull] string serviceName)
 {
     StartService(installer,
                  serviceName,
                  false);
 }
Пример #3
0
 public static void StartServiceAndWaitForKey([NotNull] IWindsorInstaller installer,
                                              [NotNull] string serviceName)
 {
     StartService(installer,
                  serviceName,
                  true);
 }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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);
     }
 }
Пример #7
0
        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);
            }
        }
Пример #8
0
        public void SetUp()
        {
            container = new WindsorContainer();

            installer = new AppInstaller();
            container.Install(installer);
        }
Пример #9
0
 public static void Initialize(IWindsorInstaller installer)
 {
     if (installer != null)
     {
         Container.Install(installer);
     }
 }
Пример #10
0
        public static IMockBuilder <TService> IntegrationTest <TService>(IWindsorInstaller windsorInstaller)
            where TService : class
        {
            var testBuilder = new MockBuilder <TService>(windsorInstaller);

            return(testBuilder);
        }
Пример #11
0
 /// <summary>
 /// Add installer
 /// </summary>
 /// <param name="installer"></param>
 public void AddControllerInstaller(IWindsorInstaller installer)
 {
     if (ControllerInstallers == null)
     {
         ControllerInstallers = new List <IWindsorInstaller>();
     }
     ControllerInstallers.Add(installer);
 }
Пример #12
0
        /// <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;
        }
Пример #13
0
 /// <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);
 }
Пример #14
0
 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>();
 }
Пример #15
0
 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>();
 }
Пример #16
0
        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);
        }
Пример #17
0
        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);
        }
Пример #18
0
        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());
        }
Пример #19
0
        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);
        }
Пример #21
0
        /// <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);
        }
Пример #22
0
        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);
        }
Пример #28
0
        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);
        }
Пример #29
0
        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);
        }
Пример #30
0
        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()
                );
        }
Пример #31
0
        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));
        }
Пример #33
0
        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);
            }
        }
Пример #34
0
 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);
        }
Пример #36
0
        public void Initialize()
        {
            IWindsorInstaller[] castleCompanents = new IWindsorInstaller[]
            {
                new InterceptorInstaller(),
                new ServiceInstaller(),
                new RepoInstaller(),
                new AggregateInstaller()
            };

            _windsorCompanents = new WindsorContainer().AddFacility <TypedFactoryFacility>();
            _windsorCompanents.Install(castleCompanents);
        }
Пример #37
0
        public void Initialize()
        {
            Container = new WindsorContainer("Config/Windsor.xml");

            var defaultInstallers = new IWindsorInstaller[]
            {
                new InfrastructureInstaller()
            };

            var installers = defaultInstallers.Concat(GetInstallers()).ToArray();

            Container.Install(installers);
        }
Пример #38
0
        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);
        }
Пример #39
0
 public void Add(IWindsorInstaller instance)
 {
     installers.Add(instance);
 }
Пример #40
0
 public WebServiceInstaller(IWindsorInstaller inner)
 {
     _inner = inner;
 }
Пример #41
0
 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);
 }
Пример #43
0
 public Bootstrapper RegisterInstaller(IWindsorInstaller windsorInstaller)
 {
     _container.Install(windsorInstaller);
     return this;
 }