Пример #1
0
 private BasedOnDescriptor FindDomainServices()
 {
     return(AllTypes.FromAssemblyContaining <IDomainService>()
            .BasedOn <DomainServiceBase>()
            .If(Component.IsInSameNamespaceAs <DomainServiceBase>())
            .If(t => t.Name.EndsWith("Service")));
 }
Пример #2
0
 /// <summary>
 /// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>.
 /// </summary>
 /// <param name="container">The container.</param>
 /// <param name="store">The configuration store.</param>
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(AllTypes.FromAssemblyContaining <NHibernateInstaller>().BasedOn(typeof(IConvention)));
     container.Register(Component.For <IBootstrapperTask>().ImplementedBy <ConfigureNHibernateFacility>());
     container.AddFacility <TransactionFacility>();
     container.Register(Component.For <ITransactionManager>().ImplementedBy <DefaultTransactionManager>());
 }
Пример #3
0
        public void Install(IWindsorContainer container,
                            IConfigurationStore store)
        {
            container.Register(AllTypes
                               .FromAssemblyContaining <HomeController>()
                               .BasedOn <IController>()
                               .Configure(r => r.LifeStyle.PerWebRequest));

            //Register types..

            string connectionString = ConfigurationManager.ConnectionStrings["ApplicationDbEntities"].ConnectionString;

            container.Register(AllTypes
                               .FromAssemblyContaining <SqlCurrencyRepository>()
                               .Where(t => t.Name.StartsWith("Sql"))
                               .WithService
                               .Select((t, b) => new[] { t.BaseType })
                               .Configure(r => r.LifeStyle.PerWebRequest
                                          .DependsOn((new
            {
                connString = connectionString
            }))));

            if (!String.IsNullOrEmpty(connectionString))
            {
                SqlDependency.Start(connectionString);
            }
        }
Пример #4
0
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(AllTypes.FromAssemblyContaining(typeof(CompetitionRepository))
                        .Pick().If(Component.IsInSameNamespaceAs <CompetitionRepository>())
                        .Configure(c => c.Named(c.ServiceType.Name).LifeStyle.PerWebRequest)
                        );
 }
Пример #5
0
 private BasedOnDescriptor Repositorios()
 {
     return(AllTypes.FromAssemblyContaining <FluentConfigurator>()
            .BasedOn(typeof(IRepositorio <>))
            .WithService
            .AllInterfaces());
 }
Пример #6
0
        public void Install(IWindsorContainer container,
                            IConfigurationStore store)
        {
            container.Register(AllTypes
                               .FromAssemblyContaining <HomeController>()
                               .BasedOn <IController>()
                               .Configure(r => r.LifeStyle.PerWebRequest));

            container.Register(AllTypes
                               .FromAssemblyContaining <BasketService>()
                               .Where(t => t.Name.EndsWith("Service"))
                               .WithService
                               .AllInterfaces());
            container.Register(AllTypes
                               .FromAssemblyContaining <BasketDiscountPolicy>()
                               .Where(t => t.Name.EndsWith("Policy"))
                               .WithService
                               .Select((t, b) => new[] { t.BaseType }));

            string connectionString =
                ConfigurationManager.ConnectionStrings
                ["CommerceObjectContext"].ConnectionString;

            container.Register(AllTypes
                               .FromAssemblyContaining <SqlProductRepository>()
                               .Where(t => t.Name.StartsWith("Sql"))
                               .WithService
                               .Select((t, b) => new[] { t.BaseType })
                               .Configure(r => r.LifeStyle.PerWebRequest
                                          .DependsOn((new
            {
                connString = connectionString
            }))));
        }
Пример #7
0
 public void Install(IWindsorContainer container,
                     IConfigurationStore store)
 {
     container.Register(AllTypes
                        .FromAssemblyContaining <Steak>()
                        .BasedOn <IIngredient>());
 }
Пример #8
0
 private BasedOnDescriptor FindRepositories()
 {
     return(AllTypes.FromAssemblyContaining <IRepository>()
            .BasedOn <IRepository>()
            .If(Component.IsInSameNamespaceAs <RepositoryBase>())
            .If(t => t.Name.EndsWith("Repository")));
 }
        /// <summary>
        /// Configures the <see cref="IWindsorContainer"/>. May be overwritten in a derived class to add specific
        /// type mappings required by the application.
        /// </summary>
        protected virtual void ConfigureContainer()
        {
            Container.Register(Component.For <ILoggerFacade>().Instance(Logger));

            Container.Register(Component.For <IModuleCatalog>().Instance(ModuleCatalog));

            if (useDefaultConfiguration)
            {
                Container.Register(Component.For <IWindsorContainer>().Instance(Container));
                RegisterTypeIfMissing(typeof(IServiceLocator), typeof(WindsorServiceLocator), true);
                RegisterTypeIfMissing(typeof(IModuleInitializer), typeof(ModuleInitializer), true);
                RegisterTypeIfMissing(typeof(IModuleManager), typeof(ModuleManager), true);
                RegisterTypeIfMissing(typeof(RegionAdapterMappings), typeof(RegionAdapterMappings), true);
                RegisterTypeIfMissing(typeof(IRegionManager), typeof(RegionManager), true);
                RegisterTypeIfMissing(typeof(IEventAggregator), typeof(EventAggregator), true);
                RegisterTypeIfMissing(typeof(IRegionViewRegistry), typeof(RegionViewRegistry), true);
                RegisterTypeIfMissing(typeof(IRegionBehaviorFactory), typeof(RegionBehaviorFactory), true);
                RegisterTypeIfMissing(typeof(IRegionNavigationJournalEntry), typeof(RegionNavigationJournalEntry), false);
                RegisterTypeIfMissing(typeof(IRegionNavigationJournal), typeof(RegionNavigationJournal), false);
                RegisterTypeIfMissing(typeof(IRegionNavigationService), typeof(RegionNavigationService), false);
                RegisterTypeIfMissing(typeof(IRegionNavigationContentLoader), typeof(RegionNavigationContentLoader), true);
                RegisterTypeIfMissing(typeof(DelayedRegionCreationBehavior), typeof(DelayedRegionCreationBehavior), false);

                // register region adapters
                Container.Register(AllTypes.FromAssemblyContaining <IRegionAdapter>().BasedOn <IRegionAdapter>()
                                   .Configure(c => c.LifeStyle.Transient));

                // register region behaviors
                Container.Register(AllTypes.FromAssemblyContaining <IRegionBehavior>().BasedOn <IRegionBehavior>()
                                   .Configure(c => c.LifeStyle.Transient));
            }
        }
Пример #10
0
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(AllTypes
                        .FromAssemblyContaining <HomeController>()
                        .BasedOn <IController>()
                        .Configure(r => r.LifeStyle.PerWebRequest));
 }
Пример #11
0
 public virtual void Register(IKernel kernel)
 {
     kernel.Register(AllTypes.FromAssemblyContaining <ServiceRegistration>()
                     .Where(t => t.Namespace == "Rhino.Licensing.AdminTool.Services")
                     .WithService.FirstInterfaceOnClass()
                     .Configure(c => c.LifeStyle.Transient));
 }
Пример #12
0
        protected override IServiceLocator CreateContainer()
        {
            var windsor = new WindsorContainer(new XmlInterpreter());

            windsor.Kernel.AddFacility("rhino.esb", new RhinoServiceBusFacility());

            windsor.Register(
                Component.For <ICache>().ImplementedBy <PersistentCache>()
                .DependsOn(Property.ForKey("basePath").Eq(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Cache"))),
                Component.For <IMessageModule>().ImplementedBy <CachingMessageModule>(),
                AllTypes.FromAssemblyContaining <MyBooksResponseConsumer>()
                .Where(x => typeof(IMessageConsumer).IsAssignableFrom(x))
                .Configure(registration => registration.LifeStyle.Is(LifestyleType.Transient)),
                AllTypes.FromAssemblyContaining <AddToQueue>()
                .Where(x => x.Namespace.StartsWith("Alexandria.Client.Commands"))
                .Configure(registration => registration.LifeStyle.Is(LifestyleType.Transient)),
                Component.For <ApplicationModel>().ImplementedBy <ApplicationModel>()
                );

            var serviceBus = windsor.Resolve <IStartableServiceBus>();

            serviceBus.Start();

            return(new WindsorAdapter(windsor));
        }
Пример #13
0
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            container.Register(AllTypes.FromAssemblyContaining(typeof(IMessageChannelManager))
                               .Pick()
                               .If(Component.IsInNamespace("Damascus.Core"))
                               .If(t => t.Name.EndsWith("Manager", StringComparison.Ordinal))
                               .WithService.DefaultInterfaces()
                               .Configure(c => c.LifestyleTransient()));

            container.Register(AllTypes.FromAssemblyContaining(typeof(IStep))
                               .Pick()
                               .If(Component.IsInNamespace("Damascus.Core"))
                               .If(t => t.Name.EndsWith("Step", StringComparison.Ordinal))
                               .Configure(c => c.LifestyleTransient()));

            container.Register(Component.For <IIvrXmlWriter>().ImplementedBy <TwilioIvrWriter>().LifestyleTransient());

            container.Register(Component.For <TwillioConfig>().Instance(new TwillioConfig()
            {
                AccountSid       = ConfigurationManager.AppSettings["TwillioAccountSid"],         //"ACca775b6d44d34b80a1632effeddbcedd",
                AuthToken        = ConfigurationManager.AppSettings["TwillioAuthToken"],          //"238e98899d2fc49efb559fd9f841e8c6",
                SmsOutPhone      = ConfigurationManager.AppSettings["TwillioSmsOutPhone"],        //"786-465-2251",
                CallPhone        = ConfigurationManager.AppSettings["TwillioCallPhone"],          //"786-465-2251",
                VoiceCallbackUrl = ConfigurationManager.AppSettings["TwillioBaseUrl"] + "/call",  //www.voiceflows.com
                EmailCallbackUrl = ConfigurationManager.AppSettings["TwillioBaseUrl"] + "/email", //www.voiceflows.com
            }));
        }
Пример #14
0
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            container.Register(AllTypes.FromAssemblyContaining(typeof(IMessageChannelManager))
                               .Pick()
                               .If(Component.IsInNamespace("Damascus.Core"))
                               .If(t => t.Name.EndsWith("Manager", StringComparison.Ordinal) || t.Name.EndsWith("Sender", StringComparison.Ordinal))
                               .WithService.DefaultInterfaces()
                               .Configure(c => c.LifestyleSingleton()));

            container.Register(Component.For <TwillioConfig>().Instance(new TwillioConfig()
            {
                AccountSid       = SettingManager.Get("TwillioAccountSid"),
                AuthToken        = SettingManager.Get("TwillioAuthToken"),
                SmsOutPhone      = SettingManager.Get("TwillioSmsOutPhone"),
                CallPhone        = SettingManager.Get("TwillioCallPhone"),
                VoiceCallbackUrl = SettingManager.Get("TwillioBaseUrl") + "/call",
                EmailCallbackUrl = SettingManager.Get("TwillioBaseUrl") + "/email",
            }));

            container.Register(Component.For <SmtpConfig>().Instance(new SmtpConfig()
            {
                Username   = SettingManager.Get("SendGrid.Username"),
                Password   = SettingManager.Get("SendGrid.Password"),
                Port       = 587,
                SmtpServer = "smtp.sendgrid.net",
            }));
        }
Пример #15
0
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         AllTypes.FromAssemblyContaining(typeof(IFoo)).BasedOn <IFoo>(),
         Classes.FromAssemblyContaining(typeof(IFoo)).BasedOn <IFoo>(),
         Castle.MicroKernel.Registration.Types.FromAssemblyContaining(typeof(IFoo)).BasedOn <IFoo>()
         );
 }
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(AllTypes.FromAssemblyContaining <ShellViewModel>()
                               .Where(t => !t.IsInterface && !t.IsAbstract && typeof(Screen).IsAssignableFrom(t) && !t.Equals(typeof(ShellViewModel)))
                               .Configure(c => c.LifeStyle.Transient));

            container.Register(Component.For <IShellViewModel>().ImplementedBy <ShellViewModel>());
        }
Пример #17
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.AddFacility <TypedFactoryFacility>();

            container.Register(
                AllTypes.FromAssemblyContaining(typeof(CreateCustomerCommandHandler))
                .Where(x => x.GetInterface(typeof(Consumes <> .All).Name) != null));
        }
Пример #18
0
 /// <summary>
 /// Registers services
 /// </summary>
 /// <param name="container">The container</param>
 private static void RegisterServices(WindsorContainer container)
 {
     container.Register(AllTypes.FromAssemblyContaining(typeof(User))
                        .Where(type => type.Name.EndsWith("Service"))
                        .If(type => type.Namespace.StartsWith("BookDatabase.Api.Services"))
                        .WithService.DefaultInterface()
                        .Configure(c => c.LifeStyle.Singleton));
 }
Пример #19
0
 protected override void RegisterApplicationServices(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(
         AllTypes
         .FromAssemblyContaining <INoSeqCalculatorService>()
         .Pick()
         .WithServiceAllInterfaces()
         .LifestyleTransient());
 }
Пример #20
0
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         AllTypes
         .FromAssemblyContaining <OneEntity>()
         .BasedOn(typeof(GenericInterface <>))
         .WithService
         .AllInterfaces());
 }
Пример #21
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(AllTypes.FromAssemblyContaining <CommandExecutor>().BasedOn <IInterceptor>().WithService.Self());

            container.Register(Component.For <ICommandExecutor>().ImplementedBy <CommandExecutor>());
            //.Interceptors<ContainerScopeWrapper>()
            //.Interceptors<TransactionWrapper>()
            //.Interceptors<SameNhibernateSessionAndTransactionWrapper>());
        }
Пример #22
0
        public void Register_All_Class_InSameNamespaceAs()
        {
            _container.Register(AllTypes
                                .FromAssemblyContaining <ICompressor>()
                                .BasedOn <ICompressor>()
                                .WithServiceBase());

            _container.ResolveAll <ICompressor>().Length.Should().Be.GreaterThan(0);
        }
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         AllTypes
         .FromAssemblyContaining <UserService>()
         .Where(Component.IsInSameNamespaceAs <UserService>())
         .WithService.DefaultInterfaces()
         .Configure(c => c.LifestyleTransient())
         );
 }
Пример #24
0
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         AllTypes
         .FromAssemblyContaining <LogService>()
         .Where(t => t.Name.EndsWith("Service"))
         .WithService.Select(IoC.SelectByInterfaceConvention)
         .LifestyleHybridPerWebRequestPerThread()
         );
 }
Пример #25
0
        public WindsorControllerFactory(IWindsorContainer container)
        {
            this.container = container;

            var descriptor = AllTypes.FromAssemblyContaining <HomeController>()
                             .BasedOn <Controller>()
                             .Configure(c => c.LifeStyle.Transient);

            container.Register(descriptor);
        }
Пример #26
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(AllTypes.FromAssemblyContaining <ViewRepository>()
                               .BasedOn(typeof(IViewFactory <,>)).WithService.AllInterfaces());

            container.Register(AllTypes.FromAssemblyContaining <ViewRepository>()
                               .BasedOn(typeof(IViewFactory <>)).WithService.AllInterfaces());

            container.Register(Component.For <IViewRepository>().Instance(new ViewRepository(container.Resolve)));
        }
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         AllTypes.FromAssemblyContaining(typeof(IReadRepository))
         .Where(x => x.GetInterface(typeof(IReadRepository).Name) != null)
         .WithService.AllInterfaces());
     container.Register(
         AllTypes.FromAssemblyContaining <IReadRepository>()
         .BasedOn(typeof(Consumes <> .All)));
 }
Пример #28
0
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container
     .Register(AllTypes.FromAssemblyContaining <IService>()
               .BasedOn <IService>()
               .WithServiceAllInterfaces()
               .LifestyleSingleton()
               .Configure(c => c.Interceptors <ServiceInterceptor>()),
               AllTypes.FromAssemblyContaining <IService>().BasedOn <IInterceptor>()
               );
 }
Пример #29
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(AllTypes.FromAssemblyContaining <ViewRepository>()
                               .BasedOn(typeof(IEventHandler <>)).WithService.AllInterfaces());

            var eventBus = container.Resolve <IEventBus>();

            eventBus.RegisterEventHandler <CameraStreamCreated>(container.Resolve <IEventHandler <CameraStreamCreated> >().Handle);
            eventBus.RegisterEventHandler <MeetingCreated>(container.Resolve <IEventHandler <MeetingCreated> >().Handle);
            eventBus.RegisterEventHandler <UserAssociatedWithIdentity>(container.Resolve <IEventHandler <UserAssociatedWithIdentity> >().Handle);
            eventBus.RegisterEventHandler <UserCreated>(container.Resolve <IEventHandler <UserCreated> >().Handle);
        }
Пример #30
0
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
                AllTypes.FromAssemblyContaining <Buildings>()
                .BasedOn <IConsumer>()
                .LifestyleTransient(),

                AllTypes.FromAssemblyContaining <ViewBase>()
                .BasedOn <IConsumer>()
                .LifestyleTransient()
                );
        }