/// <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.IsViewModel( t ) && !conventions.IsExcluded( t ) ) .WithService.Select( ( type, baseTypes ) => conventions.SelectViewModelContracts( type ) ) .Configure( r => { r.PropertiesIgnore( conventions.IgnoreViewModelPropertyInjection ); var services = this.GetServices( r ); if ( conventions.IsShellViewModel( services, r.Implementation) ) { r.LifeStyle.Is( LifestyleType.Singleton ); } else { r.LifeStyle.Is( LifestyleType.Transient ); } } ) ); container.Register ( AllTypes.FromAssemblyInDirectory( new AssemblyFilter( currentDirectory ).FilterByAssembly( conventions.IncludeAssemblyInContainerScan ) ) .IncludeNonPublicTypes() .Where( t => conventions.IsView( t ) && !conventions.IsExcluded( t ) ) .WithService.Select( ( type, baseTypes ) => conventions.SelectViewContracts( type ) ) .Configure( r => { r.PropertiesIgnore( conventions.IgnoreViewPropertyInjection ); var services = this.GetServices( r ); if ( conventions.IsShellView( services, r.Implementation ) ) { r.LifeStyle.Is( LifestyleType.Singleton ); } else { r.LifeStyle.Is( LifestyleType.Transient ); } } ) ); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.AddFacility<AutoTxFacility>(); container.Register(Component.For<INHibernateInstaller>().ImplementedBy<NHibernateInstaller>());//.LifeStyle.Singleton); var ni = container.Resolve<INHibernateInstaller>(); var t = container.ResolveAll<IInterceptor>(); //container.AddFacility<NHibernateFacility>(); container.AddFacility<NHibernateFacility>(f => f.DefaultLifeStyle = DefaultSessionLifeStyleOption.SessionPerWebRequest); container.Install(FromAssembly.Containing<PersonRepository>()); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.Register( Component .For<PdfDecrypt>(), Component .For<CreateImageFromPdfTask>() .ImplementedBy<CreateImageFromPdfTask>() .LifestyleTransient(), Component .For<Func<CreateImageFromPdfTask>>() .Instance(() => container.Resolve<CreateImageFromPdfTask>()) ); //var check = container.Resolve<CreateImageFromPdfTask>(); }
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<MixedCurriculumStorage>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton), Component.For<ICurriculumService>().ImplementedBy<CurriculumService>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton) ); curriculumStorage = container.Resolve<ICurriculumStorage>(); }
/// <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(); // Registriamo gli handler container.Register ( AllTypes.FromAssemblyInDirectory( new AssemblyFilter( currentDirectory ).FilterByAssembly( conventions.IncludeAssemblyInContainerScan ) ) .IncludeNonPublicTypes() .Where( t => conventions.IsMessageHandler( t ) && !conventions.IsExcluded( t ) ) .WithService.Select( ( type, baseTypes ) => conventions.SelectMessageHandlerContracts( type ) ) .Configure( c => c.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 ) ); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.Register( Component.For<IDataContext>().ImplementedBy<DataContext>() .DependsOn(Dependency.OnAppSettingsValue("connectionString", "Highway.ConnectionString")) .LifeStyle.Transient, Component.For<IRepository>().ImplementedBy<Repository>() .LifeStyle.Transient, Component.For<IMappingConfiguration>().ImplementedBy<HighwayMappings>(), Component.For<ILog>().UsingFactoryMethod((k, c) => LogManager.GetLogger("Highway")), Component.For<IContextConfiguration>().ImplementedBy<DefaultContextConfiguration>(), Component.For<IRepositoryFactory>().AsFactory().LifestyleTransient(), Component.For<IDatabaseInitializer<DataContext>>() .ImplementedBy<DropCreateDatabaseIfModelChanges<DataContext>>() .DependsOn(Dependency.OnAppSettingsValue("connectionString", "Highway.ConnectionString")) ); Database.SetInitializer(container.Resolve<IDatabaseInitializer<DataContext>>()); }
/// <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 ) ); }