当前位置: 首页>>代码示例>>C#>>正文


C# IWindsorContainer.AddFacility方法代码示例

本文整理汇总了C#中IWindsorContainer.AddFacility方法的典型用法代码示例。如果您正苦于以下问题:C# IWindsorContainer.AddFacility方法的具体用法?C# IWindsorContainer.AddFacility怎么用?C# IWindsorContainer.AddFacility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWindsorContainer的用法示例。


在下文中一共展示了IWindsorContainer.AddFacility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.AddFacility<TypedFactoryFacility>();
            container.AddFacility<LoggingFacility>(
                facility => facility.UseNLog().LogUsing(LoggerImplementation.NLog).WithConfig(NlogConfigPath));

            container.Register(
                Component.For<IInterceptor>().ImplementedBy<ExceptionInterceptor>(),
                Component.For<ICommandFactory>().AsFactory(),
                Component.For<IQueryFactory>().AsFactory(),

                Classes.FromThisAssembly().BasedOn<ICommand>().WithServiceSelf().LifestylePerWebRequest(),
                Classes.FromThisAssembly().BasedOn<IQuery>().WithServiceSelf().LifestylePerWebRequest(),

                Component.For<IPayrollDetailsHelper>()
                    .ImplementedBy<PayrollDetailsHelper>()
                    .DependsOn(Dependency.OnValue("benefitsDeduction", Convert.ToInt32(GetConfigValue("benefitsDeduction"))))
                    .DependsOn(Dependency.OnValue("dependentDeductions", Convert.ToInt32(GetConfigValue("dependentDeductions"))))
                    .DependsOn(Dependency.OnValue("savingsPercentage", Convert.ToInt32(GetConfigValue("SavingsPercentage"))))
                    .LifestylePerWebRequest(),

                Component.For<IDapperHub>()
                    .ImplementedBy<DapperHub>()
                    .DependsOn(Dependency.OnValue("databaseConnection", GetConnectionString()))
                    .LifestylePerWebRequest(),
                
                Classes.FromThisAssembly().BasedOn<ApiController>().LifestyleTransient().Configure(registration => registration.Interceptors<ExceptionInterceptor>()));
        }
开发者ID:SparkyCoder,项目名称:FakeLocity,代码行数:28,代码来源:DependencyInstaller.cs

示例2: AddResolversAndFacilities

 private static void AddResolversAndFacilities(IWindsorContainer container)
 {
     container.Kernel.Resolver.AddSubResolver(new CachingSessionResolver());
     container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel));
     container.AddFacility<TypedFactoryFacility>();
     container.AddFacility<StartableFacility>();
 }
开发者ID:jladuval,项目名称:MyPlace,代码行数:7,代码来源:ContainerInit.cs

示例3: Start

		private void Start()
		{
			container = new WindsorContainer();
			container.AddFacility<LoggingFacility>(f => f.UseNLog());

			container
				.AddFacility<AutoTxFacility>()
				.Register(
                    Component.For<IConfigurationPersister>().ImplementedBy<FileConfigurationPersister>(),
					Component.For<INHibernateInstaller>().ImplementedBy<NHibInstaller>().LifeStyle.Singleton,
					Component.For<Logger>().LifeStyle.Singleton)
				.AddFacility<NHibernateFacility>();

			using (var scope = new ResolveScope<Logger>(container))
			{
				using (var up = new ResolveScope<Configuration>(container))
				{
					new SchemaUpdate(up.Service).Execute(false, true);
				}

				Console.WriteLine("Current log contents:");
				Console.WriteLine("[utc date] - [text]");
				Console.WriteLine("-------------------");
				scope.Service.ReadLog(Console.WriteLine); // read everything from saved log
				scope.Service.WriteToLog(string.Format("{0} - Started", DateTime.UtcNow)); // write simple line to log
			}
		}
开发者ID:razorDevelopers,项目名称:Castle.Facilities.NHibernate,代码行数:27,代码来源:Program.cs

示例4: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.AddFacility<SqlServerPersistenceFacility>();
            container.AddFacility<DomainServicesFacility>();
            container.AddFacility<ApplicationServicesFacility>();

            container.Register(
                Classes.FromThisAssembly()
                    .BasedOn(typeof (IBootstrapper))
                    .WithServiceBase()
                    .LifestyleSingleton());

            // for bootstrappers
            container.Register(
                Component.For<WindsorControllerFactory>().ImplementedBy<WindsorControllerFactory>().LifestyleSingleton(),
                Component.For<WindsorValidatorFactory>().ImplementedBy<WindsorValidatorFactory>().LifestyleSingleton());

            // register all Fluent Validators
            container.Register(
                Classes.FromThisAssembly()
                .BasedOn(typeof(IValidator<>))
                .WithServiceBase()
                .LifestyleTransient());

            // register all controllers
            container.Register(Classes.FromThisAssembly()
                            .BasedOn<IController>()
                            .LifestyleTransient());
        }
开发者ID:christensena,项目名称:DDDIntro,代码行数:29,代码来源:WindsorInstaller.cs

示例5: BuildContainer

        public static void BuildContainer()
        {
            BuilderSetup.SetDefaultPropertyNamer(new PersistableEntityPropertyNamer(new ReflectionUtil()));
            _container = new WindsorContainer();

            _container = new WindsorContainer();
            _container.Kernel.Resolver.AddSubResolver(new CollectionResolver(_container.Kernel));
            
            _container.AddFacility<ConfigurationFacility>();
            var config = _container.Resolve<IEnvironmentConfiguration>();
            var possiblyInjectedProjectFlavour = Process.GetCurrentProcess().GetProjectFlavour() ?? ProjectFlavour.Application;

            EntityFrameworkDataProviderFacility.ConnectionStringProvider =
                () => config.ConnectionString(possiblyInjectedProjectFlavour);

            EntityFrameworkDataProviderFacility.WithDatabaseInitialiser<AlwaysDropAndRecreateDatabaseStrategyInitialiser>();
            
            _container.AddFacility<EntityFrameworkDataProviderFacility>();

            SecurityInstaller.SecurityHelperType = config.SecurityHelperType(possiblyInjectedProjectFlavour);

            _container.Install(FromAssembly.This());
            
            _container.Register(Component.For<IWindsorContainer>().Instance(_container));
        }
开发者ID:Gwayaboy,项目名称:iDeal,代码行数:25,代码来源:ApplicationConfigurator.cs

示例6: Init

		public void Init()
		{
			container = new WindsorContainer();

			container.AddFacility("1", new MyInterceptorGreedyFacility());
			container.AddFacility("2", new MyInterceptorGreedyFacility());
			container.AddFacility("3", new MyInterceptorGreedyFacility());
		}
开发者ID:Huddle,项目名称:Castle.Windsor,代码行数:8,代码来源:InterceptorsTestCase.cs

示例7: ExplainFacilitiesToWindsor

        public static void ExplainFacilitiesToWindsor(IWindsorContainer container)
        {
            container.AddFacility<TypedFactoryFacility>();
            container.AddFacility<LoggingFacility>(f => f.UseLog4Net().WithConfig("log4net.config"));

            container.Register(Component.For<ILazyComponentLoader>()
                                        .ImplementedBy<LazyOfTComponentLoader>());
        }
开发者ID:tommarien,项目名称:nebula,代码行数:8,代码来源:Boot.cs

示例8: ConfigureFacilities

        public IWindsorContainer ConfigureFacilities(IWindsorContainer container)
        {
            var facility = new LoggingFacility(LoggerImplementation.Console);
            container.AddFacility<FactorySupportFacility>();
            container.AddFacility("logging", facility);

            return container;
        }
开发者ID:Tigraine,项目名称:elms-connector,代码行数:8,代码来源:ConventionBasedContainerFactory.cs

示例9: BootstrapContainer

 private void BootstrapContainer()
 {
     logger.Debug("Installing Winsdor Castle.");
     Container = new WindsorContainer();
     Container.AddFacility<LoggingFacility>(f => f.UseNLog("NLog.config"));
     Container.AddFacility<TypedFactoryFacility>();
     Container.Register(Component.For<IContainerAccessor>().Instance(this));
     Container.Install(FromAssembly.Containing<CollectorApiInstaller>());
 }
开发者ID:GymJuice,项目名称:Collector,代码行数:9,代码来源:Collector.cs

示例10: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.AddFacility<TypedFactoryFacility>();
            container.AddFacility<FactorySupportFacility>();

            container.Register(
                AllTypes.FromAssemblyContaining(typeof (CreateCustomerCommandHandler))
                .Where(x => x.GetInterface(typeof (Consumes<>.All).Name) != null));
        }
开发者ID:karaaie,项目名称:Documently,代码行数:9,代码来源:CommandHandlerInstaller.cs

示例11: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel));

            container.AddFacility(new StartableFacility());
            container.AddFacility<LoggingFacility>(f => f.UseNLog().WithConfig(logFileName ?? "nlog.config"));
            container.AddFacility<TypedFactoryFacility>();

            container.Register(
                Component.For<IFileSystem>().ImplementedBy<FileSystem>());
        }
开发者ID:jonnii,项目名称:statr,代码行数:11,代码来源:InfrastructureInstaller.cs

示例12: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(Component.For<IWindsorContainer>().Instance(container));

            container.AddFacility<MassTransitFacility>(f => f.ReceiveFromUri = Keys.MassTransitReceiveFrom);
            container.AddFacility<EventStoreFacility>(f =>
                                                          {
                                                              f.ConnectionString = Keys.EventStoreKeyName;
                                                              f.SqlDialect = new PostgreSqlDialect();
                                                          });
        }
开发者ID:tmassey,项目名称:QUADAUTO,代码行数:11,代码来源:WindsorInstaller.cs

示例13: SetupWindsor

 private void SetupWindsor()
 {
     container = new WindsorContainer(new XmlInterpreter());
     var configBuilder = new NHConfigBuilder(Server.MapPath("/"));
     container.AddFacility("nhibernate", new NHibernateFacility(configBuilder));
     container.AddFacility<TransactionFacility>();
     container.AddComponent<TransactionalService>();
     container.AddComponent<HomeController>("home");
     new SchemaExport(configBuilder.GetConfiguration(null)).Execute(false, true, false);
     ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
 }
开发者ID:ruanzx,项目名称:mausch,代码行数:11,代码来源:Global.asax.cs

示例14: AddComponentsTo

        public static void AddComponentsTo(IWindsorContainer container, Type transactionManagerType)
        {
            ParameterCheck.ParameterRequired(container, "container");

            if (!container.Kernel.HasComponent("LogInterceptor")) {
                Core.CastleWindsor.ComponentRegistrar.AddComponentsTo(container);
                Data.CastleWindsor.ComponentRegistrar.AddComponentsTo(container, transactionManagerType);
                container.AddFacility("LogFacility", new LogFacility());
                container.AddFacility("ExceptionHandlerFacility", new ExceptionHandlerFacility());
                container.AddFacility("TransactionFacility", new TransactionFacility());
                container.AddFacility("UnitOfWorkFacility", new UnitOfWorkFacility());
            }
        }
开发者ID:robiee4u,项目名称:Sharp-Architecture-Contrib,代码行数:13,代码来源:ComponentRegistrar.cs

示例15: ApplicationContainer

        public ApplicationContainer()
        {
            container = new WindsorContainer();

            container.AddFacility<TypedFactoryFacility>();
            container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithConfig("log4net.xml"));
            container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel));
            container.Register(Component.For<LogInterceptor>());

            container.Install(new RepositoryInstaller());
            container.Install(new PresentationInstaller());
            container.Install(new ApplicationInstaller());
        }
开发者ID:kobbikobb,项目名称:TimeManager,代码行数:13,代码来源:ApplicationContainer.cs


注:本文中的IWindsorContainer.AddFacility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。