public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
                Component.For <IServiceBus>()
                .UsingFactoryMethod(() =>
                                    ServiceBusFactory.New(sbc =>
            {
                sbc.UseMsmq();
                sbc.VerifyMsmqConfiguration();

                sbc.UseMulticastSubscriptionClient();

                sbc.ReceiveFrom("msmq://localhost/web");
                sbc.SetCreateMissingQueues(true);
                sbc.UseJsonSerializer();

                sbc.Subscribe(subs => subs.LoadFrom(container));

                sbc.BeforeConsumingMessage(() => container.BeginScope());
                sbc.AfterConsumingMessage(() => CallContextLifetimeScope.ObtainCurrentScope().Dispose());
            })
                                    )
                .LifestyleSingleton()
                );
        }
Example #2
0
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(Classes.FromThisAssembly()
                               .BasedOn <ApiController>()
                               .LifestylePerWebRequest(),

                               Component.For <ILogService>()
                               .ImplementedBy <LogService>()
                               .LifeStyle.PerWebRequest,

                               Component.For <IDatabaseFactory>()
                               .ImplementedBy <DatabaseFactory>()
                               .LifeStyle.PerWebRequest,

                               Component.For <IUnitOfWork>()
                               .ImplementedBy <UnitOfWork>()
                               .LifeStyle.PerWebRequest,

                               AllTypes.FromThisAssembly().BasedOn <IHttpController>().LifestyleTransient()//,


                               );
            container.Register(Classes.FromAssemblyNamed("Oc.Carbon.ServiceLayer").Where(type => type.Name.EndsWith("Service")).WithServiceAllInterfaces().LifestylePerWebRequest());
            container.Register(Classes.FromAssemblyNamed("Oc.Carbon.Data").Where(type => type.Name.EndsWith("Repository")).WithServiceAllInterfaces().LifestylePerWebRequest());
        }
 public void Install(Castle.Windsor.IWindsorContainer container,
                     Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(Classes.FromThisAssembly()
                        .BasedOn <ApiController>()
                        .LifestylePerWebRequest());
 }
Example #4
0
        private void Init(IServiceMQ mq, IDictionary serviceKeyTypes)
        {
            if (System.Configuration.ConfigurationManager.GetSection("castle") != null)
            {
                container = new WindsorContainer(new XmlInterpreter());
            }
            else
            {
                container = new WindsorContainer();
            }
            container.AddFacility("startable", new StartableFacility());
            this.mq = mq;
            container.Kernel.AddComponentInstance("NBear.IoC.Service.IServiceMQ", typeof(IServiceMQ), mq);
            container.AddFacility("service subscribe message reqMsg", new Facilities.ServiceSubscribeMessageRequestFacility(mq));

            if (serviceKeyTypes != null && serviceKeyTypes.Count > 0)
            {
                RegisterComponents(serviceKeyTypes);
            }

            serviceProxy        = new ServiceProxy(mq, DEFAULT_MAX_TRY_NUMBER);
            serviceProxy.OnLog += new LogHandler(WriteLog);

            this.DiscoverServices();
        }
Example #5
0
 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(Component.For <CashflowProjectionGroup>()
                        .LifeStyle.Transient
                        );
     container.Register(Component.For <ICashflowProjectionGroupFactory>()
                        .AsFactory()
                        );
 }
Example #6
0
 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(Component.For <BalanceDate>()
                        .LifeStyle.Transient
                        );
     container.Register(Component.For <IBalanceDateFactory>()
                        .AsFactory()
                        );
 }
Example #7
0
 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(
         AllTypes
         .FromThisAssembly()
         .BasedOn <IController>()
         .Configure(c => c.LifeStyle.Transient
                    .Named(c.Implementation.Name)),
         Component.For <IPlugin>().ImplementedBy <SearchPlugin>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton)
         );
 }
 public void Install(Castle.Windsor.IWindsorContainer container,
                     Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(Classes.FromThisAssembly()
                        .BasedOn <ApiController>()
                        .LifestylePerWebRequest()
                        .Configure(c => c.Named(c.Implementation.Name)));
     //container.Register(Classes.FromThisAssembly()
     //              .BasedOn<IHttpController>()
     //              .LifestylePerWebRequest());
 }
Example #9
0
 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     IUDICO.Common.Localization.Initialize();
     container.Register(
         AllTypes
         .FromThisAssembly()
         .BasedOn <IController>()
         .Configure(c => c.LifeStyle.Transient
                    .Named(c.Implementation.Name)),
         Component.For <IPlugin>().ImplementedBy <AnalyticsPlugin>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton),
         Component.For <IAnalyticsService>().ImplementedBy <AnalyticsService>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton)
         );
 }
Example #10
0
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
                Component
                .For <MyInterceptorAspect>()
                .LifeStyle.Singleton,

                Component
                .For <IMyClass>()
                .ImplementedBy <MyClass>()
                .Interceptors <MyInterceptorAspect>()
                .LifeStyle.Transient);
        }
Example #11
0
 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     Localization.Initialize();
     container.Register(
         AllTypes
         .FromThisAssembly()
         .BasedOn <IController>()
         .Configure(c => c.LifeStyle.Transient
                    .Named(c.Implementation.Name))             //,
         //Component.For<IPlugin>().ImplementedBy<CourseManagmentPlugin>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton),
         //Component.For<ICourseManagment>().ImplementedBy<MixedCourseStorage>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton)
         );
 }
Example #12
0
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
                AllTypes
                .FromThisAssembly()
                .BasedOn <IController>()
                .Configure(c => c.LifeStyle.Transient
                           .Named(c.Implementation.Name)),
                Component.For <IPlugin>().ImplementedBy <CurriculumManagementPlugin>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton),
                Component.For <ICurriculumStorage>().ImplementedBy <DatabaseCurriculumStorage>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton),
                Component.For <ICurriculumService>().ImplementedBy <CurriculumService>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton)
                );

            curriculumStorage = container.Resolve <ICurriculumStorage>();
        }
Example #13
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(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            var conventions      = container.Resolve <BootstrapConventions>();
            var currentDirectory = Helpers.EnvironmentHelper.GetCurrentDirectory();

            container.Register
            (
                AllTypes.FromAssemblyInDirectory(new AssemblyFilter(currentDirectory).FilterByAssembly(conventions.IncludeAssemblyInContainerScan))
                .IncludeNonPublicTypes()
                .Where(t => conventions.IsService(t) && !conventions.IsExcluded(t))
                .WithService.Select((type, baseTypes) => conventions.SelectServiceContracts(type))
                .Configure(r =>
            {
                r.Overridable();
                r.PropertiesIgnore(conventions.IgnorePropertyInjection);
            })
            );
        }
        /// <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(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            var conventions = container.Resolve <BootstrapConventions>();

            container.Register
            (
                Component.For <TraceSource>()
                .UsingFactoryMethod(() =>
            {
                var name = ConfigurationManager
                           .AppSettings["radical/windows/presentation/diagnostics/applicationTraceSourceName"]
                           .Return(s => s, "default");

                return(new TraceSource(name));
            })
                .LifeStyle.Is(LifestyleType.Singleton)
                .PropertiesIgnore(conventions.IgnorePropertyInjection)
            );

            container.Register(
                Component.For <Application>()
                .UsingFactoryMethod(() => Application.Current)
                .LifeStyle.Is(LifestyleType.Singleton)
                .PropertiesIgnore(conventions.IgnorePropertyInjection),

                Component.For <Dispatcher>()
                .UsingFactoryMethod(() => Application.Current.Dispatcher)
                .LifeStyle.Is(LifestyleType.Singleton)
                .PropertiesIgnore(conventions.IgnorePropertyInjection)
                );

            container.Register(
                Component.For <IDispatcher>()
                .ImplementedBy <WpfDispatcher>()
                .LifeStyle.Is(LifestyleType.Singleton)
                .Overridable(),

                Component.For <IMessageBroker>()
                .ImplementedBy <MessageBroker>()
                .LifeStyle.Is(LifestyleType.Singleton)
                .Overridable()
                .PropertiesIgnore(conventions.IgnorePropertyInjection)
                );
        }
Example #15
0
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(Component.For <IFileSystem>().ImplementedBy <FileSystem>());
            container.Register(Component.For <IFileSystemWatcher>().ImplementedBy <FileSystemWatcher>().LifestyleSingleton());
            container.Register(Component.For <ILog>().ImplementedBy <Logger>().LifestyleSingleton());
            container.Register(Component.For <IScheduler>().ImplementedBy <QuartzScheduler>().LifestyleSingleton());
            container.Register(Component.For <IPackageFactory>().ImplementedBy <ZipPackageFactory>());
            container.Register(Component.For <IHttpListener>().ImplementedBy <HttpListener>().LifestyleSingleton());

            container.Register(Component.For <HttpRequestHandler>().Named("run").ImplementedBy <StartTaskHandler>());
            container.Register(Component.For <HttpRequestHandler>().Named("list").ImplementedBy <ListTasksHandler>());
            container.Register(Component.For <IHandlerFactory>().ImplementedBy <WindsorHandlerFactory>());
            container.Register(Component.For <IWindsorContainer>().Instance(container).LifestyleSingleton());

            container.Register(Component.For <Quartz.IScheduler>().UsingFactoryMethod(x =>
            {
                Quartz.ISchedulerFactory schedFact = new StdSchedulerFactory();
                return(schedFact.GetScheduler());
            }));
        }
        /// <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(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            var conventions = container.Resolve <BootstrapConventions>();

            container.Register(
                Component.For <IRegionManagerFactory>()
                .ImplementedBy <RegionManagerFactory>()
                .Overridable()
                .PropertiesIgnore(conventions.IgnorePropertyInjection),

                Component.For <IRegionService>()
                .ImplementedBy <RegionService>()
                .Overridable()
                .PropertiesIgnore(conventions.IgnorePropertyInjection),

                Component.For <IRegionManager>()
                .ImplementedBy <RegionManager>()
                .LifeStyle.Is(LifestyleType.Transient)
                .Overridable()
                .PropertiesIgnore(conventions.IgnorePropertyInjection)
                );
        }
Example #17
0
 public WindsorApiResolver(IWindsorContainer container)
 {
     _container = container;
 }
 public void Install(Castle.Windsor.IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(Classes.FromThisAssembly().Where(type => typeof(IInterceptor).IsAssignableFrom(type)).LifestyleTransient());
     container.Register(Classes.FromThisAssembly().Where(type => typeof(IRepository).IsAssignableFrom(type)).WithServiceDefaultInterfaces().Configure(c => c.LifestyleTransient().Interceptors <AspectInterceptor>()));
 }