/// <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) { container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net) .WithConfig("D:\\Home\\PersonalDevel\\log4net-Playground.config")); //change this to something better or even use App config container.AddFacility<TypedFactoryFacility>(); container.AddFacility<PersistenceFacility>(); }
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( Classes.FromAssemblyInDirectory(new AssemblyFilter(HttpRuntime.BinDirectory, "Application.Web.*")) .BasedOn<IController>() .LifestyleTransient(), Classes.FromAssemblyInDirectory(new AssemblyFilter(HttpRuntime.BinDirectory, "Application.Web.*")) .BasedOn<IHttpController>() .LifestyleTransient() ); container.Register( Component.For<IQueryableUnitOfWork, UnitOfWork>().ImplementedBy<UnitOfWork>(), Component.For<IProfileRepository, ProfileRepository>().ImplementedBy<ProfileRepository>(), Component.For<IAddressRepository, AddressRepository>().ImplementedBy<AddressRepository>(), Component.For<IAddressTypeRepository, AddressTypeRepository>().ImplementedBy<AddressTypeRepository>(), Component.For<IPhoneTypeRepository, PhoneTypeRepository>().ImplementedBy<PhoneTypeRepository>(), Component.For<IPhoneRepository, PhoneRepository>().ImplementedBy<PhoneRepository>(), Component.For<IProfileAddressRepository, ProfileAddressRepository>().ImplementedBy<ProfileAddressRepository>(), Component.For<IProfilePhoneRepository, ProfilePhoneRepository>().ImplementedBy<ProfilePhoneRepository>().LifestyleSingleton(), Component.For<IContactManager>().ImplementedBy<ContactManager>() ); container.AddFacility<LoggingFacility>(f => f.UseLog4Net()); LoggerFactory.SetCurrent(new TraceSourceLogFactory()); EntityValidatorFactory.SetCurrent(new DataAnnotationsEntityValidatorFactory()); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.AddFacility(new LoggingFacility(LoggerImplementation.Log4net, "log4net.config")); container.AddFacility(new StartableFacility()); container.Register( Component.For<IDomainEventHandlerCatalog, ICommandHandlerCatalog>().ImplementedBy<CastleFasterflectHandlerCatalog>(), Component.For<ICommandDispatcher>().ImplementedBy<CommandDispatcher>(), Component.For<IDomainEventDispatcher>().ImplementedBy<DomainEventDispatcher>(), Component.For<UnitOfWork>().ImplementedBy<UnitOfWork>()); container.Register( Component.For<AggregateRootFactory>().UsingFactoryMethod(() => new AggregateRootFactory())); container.Register( Component.For<IEventsStore>().ImplementedBy<SqlEventsStore>() .DependsOn(Property.ForKey("configurationFileName").Eq(HostingEnvironment.MapPath("~/NhEventStoreConfiguration.xml")))); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container .AddFacility<TransactionFacility>("autoTxFacility") .AddFacility<NHibernateFacility>("nhibnernateFacility", cfg => cfg.ConfigurationBuilder<FluentConfigurationBuilder>()) .Register( Component.For<ISurveyRepository>() .ImplementedBy<NHibernateSurveyRepository>() .LifeStyle.Transient ) ; }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.AddFacility<TypedFactoryFacility>(); container.Register(Classes.FromThisAssembly().BasedOn(typeof(IHub)).LifestyleTransient()); var signalRDependencyResolver = new SignalRDependencyResolver(container); Microsoft.AspNet.SignalR.GlobalHost.DependencyResolver = signalRDependencyResolver; container.Register( Component.For<IUserServiceFactory>().AsFactory() ); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.Register( Component.For(typeof(ICacheProvider<>)) .ImplementedBy(typeof(CacheProvider<>)) .LifeStyle.Transient); container.AddFacility<TypedFactoryFacility>(); container.Register( Component.For<ICacheDependencyFactory>() .AsFactory()); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { var assem = Assembly.GetExecutingAssembly(); container.Register(Classes.FromAssembly(assem).BasedOn<ApiController>().LifestyleTransient()); container.AddFacility<TypedFactoryFacility>(); container.Register( Component.For<IUserServiceFactory>().AsFactory(), Component.For<IUserService>().ImplementedBy<Shared.Membership.Service.UserService>().LifeStyle.PerWebRequest, Component.For<IDataBaseAccess>().ImplementedBy<DataBaseAccess>().LifeStyle.PerWebRequest, Component.For<IDataBaseSettings>().ImplementedBy<DataBaseSettings>().LifeStyle.PerWebRequest, Component.For<ISnapshotsRepository>().ImplementedBy<SnapshotsRepository>().LifeStyle.PerWebRequest, Component.For<IDomainHandler<SnapshotsGet>>().ImplementedBy<SnapshotsGetHandlerPersistance>().LifeStyle.PerWebRequest ); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel, true)); // PerCall setup container.AddFacility<WcfFacility>() .Register( //WCF services Component.For<IOrderService>() .ImplementedBy<OrderService>() .LifeStyle.ApplyLifeStyle(lifestyleApplier), //CQRSLite stuff Component.For<OrderCommandHandlers>().LifeStyle.ApplyLifeStyle(lifestyleApplier), Component.For<IEventPublisher>().ImplementedBy<BusEventPublisher>().LifeStyle.Singleton, Component.For<IInterProcessBus>().ImplementedBy<InterProcessBus>().LifeStyle.Singleton, Component.For<ISession>().ImplementedBy<Session>().LifeStyle.ApplyLifeStyle(lifestyleApplier), Component.For<IEventStore>().ImplementedBy<InMemoryEventStore>().LifeStyle.Singleton, Component.For<IReadModelRepository>().ImplementedBy<ReadModelRepository>().LifeStyle.Singleton, Component.For<IBusEventHandler>().ImplementedBy<OrderCreatedEventHandler>() .Named("OrderCreatedEventHandler").LifeStyle.Singleton, Component.For<IBusEventHandler>().ImplementedBy<OrderAddressChangedEventHandler>() .Named("OrderAddressChangedEventHandler").LifeStyle.Singleton, Component.For<IBusEventHandler>().ImplementedBy<OrderDeletedEventHandler>() .Named("OrderDeletedEventHandler").LifeStyle.Singleton, Component.For<IRepository>().UsingFactoryMethod( kernel => { return new CacheRepository( new Repository(kernel.Resolve<IEventStore>(), kernel.Resolve<IEventPublisher>()), kernel.Resolve<IEventStore>()); }) ); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithAppConfig()); container.AddFacility<TypedFactoryFacility>(); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { var kernel = container.Kernel; kernel.Resolver.AddSubResolver (new CollectionResolver (kernel)); container.AddFacility<TypedFactoryFacility> (); //Configuration container.Register ( Component.For<IConfigurationProvider, ISerialConfigurationProvider, IEmonCmsConfiguration> ().ImplementedBy<AppSettingsBasedConfiguration> () ); //dbContext container.Register (Component.For<IHelloHomeDbContext> ().ImplementedBy<HelloHomeDbContext> ().LifestyleBoundTo<IMessageHandler> ()); container.Register (Component.For<HelloHomeDbContext> ().LifestyleTransient().Named("TransientDbContext")); //Agents container.Register (Component.For<INodeGatewayAgent> () .ImplementedBy<NodeGatewayAgent> () .LifestyleSingleton ()); container.Register (Component.For<IEmonCmsAgent> ().ImplementedBy<EmonCmsAgent> ()); //Parsers & encoders container.Register (Classes.FromAssemblyContaining<IMessageParser> ().BasedOn<IMessageParser> ().WithServiceBase ()); container.Register ( Classes.FromAssemblyContaining<IMessageEncoder> ().BasedOn<IMessageEncoder> ().WithServiceBase (), Component.For<PinConfigEncoder> () ); //EmonCmsUpdater container.Register (Component.For<IEMonCmsUpdater> ().ImplementedBy<EMonCmsUpdater> ()); //HelloHomeGateway container.Register (Component.For<HelloHomeGateway> ()); //MessageHandlers container.Register ( Classes.FromAssemblyContaining<IMessageHandler> () .BasedOn (typeof (MessageHandler<>)) .WithServiceSelf () .LifestyleTransient (), Component.For<MessageHandlerComponentSelector> () .LifestyleSingleton (), Component.For<IMessageHandlerFactory> () .AsFactory (typeof (MessageHandlerComponentSelector)) ); //Queries & Commands container.Register (Classes.FromAssemblyContaining<IQuery> ().BasedOn<IQuery> ().WithServiceAllInterfaces ().LifestyleBoundTo<IMessageHandler> ()); container.Register (Classes.FromAssemblyContaining<ICommand> ().BasedOn<ICommand> ().WithServiceAllInterfaces ().LifestyleBoundTo<IMessageHandler> ()); //Logic container.Register ( Component.For<ITimeProvider> ().ImplementedBy<TimeProvider> ().LifestyleBoundTo<IMessageHandler> (), Component.For<IRfIdGenerationStrategy> ().ImplementedBy<FindHoleRfIdGenerationStrategy> ().LifestyleBoundTo<IMessageHandler> () ); if(_overrides != null) foreach (var r in _overrides) container.Register (r.Named (Guid.NewGuid ().ToString ()).IsDefault ()); }
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.AddFacility<LoggingFacility>(f => f.UseNLog()); }