Exemplo n.º 1
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>();
        }
Exemplo n.º 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(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)
                );
        }
        /// <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)
                );
        }
Exemplo n.º 5
0
 public object GetService(Type serviceType)
 {
     return(_container.Kernel.HasComponent(serviceType) ? _container.Resolve(serviceType) : null);
 }