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


C# WindsorContainer.AddFacility方法代码示例

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


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

示例1: SetUp

		public void SetUp()
		{
			container = new WindsorContainer();
			container.Register(Component.For<INHibernateInstaller>().ImplementedBy<ExampleInstaller>());
			container.AddFacility<AutoTxFacility>();
			container.AddFacility<NHibernateFacility>();
			container.Register(Component.For<ThreadedService>().LifeStyle.Transient);
		}
开发者ID:ols,项目名称:Castle.Facilities.NHibernate,代码行数:8,代码来源:Multiple_Threads_DependentTransactionWithParent.cs

示例2: Should_override_DefaultConfigurationBuilder

        public void Should_override_DefaultConfigurationBuilder()
        {
            var container = new WindsorContainer();

			container.AddFacility<AutoTxFacility>();
            container.AddFacility<NHibernateFacility>(f => f.ConfigurationBuilder<DummyConfigurationBuilder>());

            Assert.AreEqual(typeof(DummyConfigurationBuilder), container.Resolve<IConfigurationBuilder>().GetType());
        }
开发者ID:hconceicao,项目名称:Castle.Facilities.NHibernateIntegration3,代码行数:9,代码来源:FacilityFluentConfigTestCase.cs

示例3: Configure

 public WindsorContainer Configure()
 {
     var container = new WindsorContainer();
     container.AddFacility<FactorySupportFacility>();
     container.AddFacility<TransactionalFacility>();
     container.AddFacility<StartableFacility>(f => f.DeferredStart());
     container.Install(FromAssembly.This());
     return container;
 }
开发者ID:JamesKovacs,项目名称:fakevader,代码行数:9,代码来源:ApplicationBootstrapper.cs

示例4: Should_override_DefaultConfigurationBuilder

		public void Should_override_DefaultConfigurationBuilder()
		{
			var file = "Castle.Facilities.NHibernateIntegration.Tests/MinimalConfiguration.xml";

			var container = new WindsorContainer(new XmlInterpreter(new AssemblyResource(file)));
			container.AddFacility<AutoTxFacility>();

			container.AddFacility<NHibernateFacility>(f => f.ConfigurationBuilder<DummyConfigurationBuilder>());

			Assert.AreEqual(typeof(DummyConfigurationBuilder), container.Resolve<IConfigurationBuilder>().GetType());
		}
开发者ID:mahara,项目名称:Castle.Facilities.NHibernateIntegration,代码行数:11,代码来源:FacilityFluentConfigTestCase.cs

示例5: Should_be_able_to_revolve_ISessionManager_when_fluently_configured

        public void Should_be_able_to_revolve_ISessionManager_when_fluently_configured()
        {
            var container = new WindsorContainer();

        	container.AddFacility<AutoTxFacility>();
            container.AddFacility<NHibernateFacility>(f => f.ConfigurationBuilder<TestConfigurationBuilder>());

            var sessionManager = container.Resolve<ISessionManager>();
            sessionManager.OpenSession();
            Assert.AreEqual(typeof(TestConfigurationBuilder), container.Resolve<IConfigurationBuilder>().GetType());
        }
开发者ID:hconceicao,项目名称:Castle.Facilities.NHibernateIntegration3,代码行数:11,代码来源:FacilityFluentConfigTestCase.cs

示例6: ShouldUseDefaultSessionStore

		public void ShouldUseDefaultSessionStore()
		{
			var container = new WindsorContainer();
			container.AddFacility<AutoTxFacility>();

			container.AddFacility<NHibernateFacility>(
				f => f.ConfigurationBuilder<DummyConfigurationBuilder>());

			var sessionStore = container.Resolve<ISessionStore>();

			Assert.IsInstanceOf(typeof(LogicalCallContextSessionStore), sessionStore);
		}
开发者ID:mahara,项目名称:Castle.Facilities.NHibernateIntegration,代码行数:12,代码来源:FacilityFluentConfigTestCase.cs

示例7: Should_override_IsWeb

		public void Should_override_IsWeb()
		{
			var file = "Castle.Facilities.NHibernateIntegration.Tests/MinimalConfiguration.xml";

			var container = new WindsorContainer(new XmlInterpreter(new AssemblyResource(file)));
			container.AddFacility<AutoTxFacility>();

			container.AddFacility<NHibernateFacility>(f => f.IsWeb().ConfigurationBuilder<DummyConfigurationBuilder>());

			var sessionStore = container.Resolve<ISessionStore>();

			Assert.IsInstanceOf(typeof(CallContextSessionStore), sessionStore);
		}
开发者ID:mahara,项目名称:Castle.Facilities.NHibernateIntegration,代码行数:13,代码来源:FacilityFluentConfigTestCase.cs

示例8: GetWindsorContainer

		private static WindsorContainer GetWindsorContainer()
		{
			var c = new WindsorContainer();
			c.AddFacility<LoggingFacility>(f => f.UseNLog());
			c.Register(Component.For<INHibernateInstaller>().ImplementedBy<ExampleInstaller>());

			c.AddFacility<AutoTxFacility>();
			c.AddFacility<NHibernateFacility>();

			Assert.That(c.Kernel.HasComponent(typeof(ITransactionManager)));

			return c;
		}
开发者ID:razorDevelopers,项目名称:Castle.Facilities.NHibernate,代码行数:13,代码来源:SimpleUseCase_ProtectedMethod.cs

示例9: Application_Start

        void Application_Start(object sender, EventArgs e)
        {
            var container = new WindsorContainer();
            container.AddFacility<TypedFactoryFacility>();
            container.AddFacility<CollectionFacility>();

            RegisterViews(container);
            RegisterPresentersByConvention(container);
            RegisterMigrationTypes(container);
            RegisterExtensions(container);
            CatalogueExtensions(container);

            PresenterBinder.Factory = new CastlePresenterFactory(container.Kernel);
        }
开发者ID:stephengodbold,项目名称:workitem-migrator,代码行数:14,代码来源:Global.asax.cs

示例10: Configure

        //public static IWindsorContainer Container;

        public static IWindsorContainer Configure(StartFlag startFlag)
        {

            var container = new WindsorContainer();
            container.AddFacility<StartableFacility>(sf => sf.DeferredStart(startFlag));
            container.AddFacility<TypedFactoryFacility>();
            container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel, allowEmptyCollections: false));
            container.Install(FromAssembly.This());

            //WindsorConfig.Container = container;

            return container;

        }
开发者ID:MedicalIT,项目名称:TechStackDemo,代码行数:16,代码来源:WindsorConfig.cs

示例11: AddCoreFromXML

 public void AddCoreFromXML()
 {
     var solrFacility = new SolrNetFacility();
     var container = new WindsorContainer(new XmlInterpreter(new StaticContentResource(@"<castle>
     <facilities>
     <facility id='solr'>
     <solrURL>http://localhost:8983/solr/defaultCore</solrURL>
     <cores>
     <core id='core0-id'>
         <documentType>Castle.Facilities.SolrNetIntegration.Tests.Tests+Document, Castle.Facilities.SolrNetIntegration.Tests</documentType>
         <url>http://localhost:8983/solr/core0</url>
     </core>
     <core id='core1-id'>
         <documentType>Castle.Facilities.SolrNetIntegration.Tests.Tests+Document, Castle.Facilities.SolrNetIntegration.Tests</documentType>
         <url>http://localhost:8983/solr/core1</url>
     </core>
     <core id='core2-id'>
         <documentType>Castle.Facilities.SolrNetIntegration.Tests.Tests+Core1Entity, Castle.Facilities.SolrNetIntegration.Tests</documentType>
         <url>http://localhost:8983/solr/core1</url>
     </core>
     </cores>
     </facility>
     </facilities>
     </castle>")));
     container.AddFacility("solr", solrFacility);
     TestCores(container);
 }
开发者ID:AlmostTooCool,项目名称:SolrNet,代码行数:27,代码来源:Tests.cs

示例12: ExternalConfigurationUsage

		public void ExternalConfigurationUsage()
		{
			WindsorContainer container = new WindsorContainer( ConfigHelper.ResolvePath("../aop_castle_config.xml") );

			container.AddFacility( "aspectsharp", new AspectSharpFacility() );
			
			// Logger implementation
			container.AddComponent( "logger", typeof(ILogger), typeof(MemoryLogger) );

			// AopAlliance interceptors
			container.AddComponent( "log4netinterceptor", typeof(LoggerTraceInterceptor) );
			
			// Protocol handlers
			container.AddComponent( "protocolhandler.miranda", 
				typeof(IProtocolHandler), typeof(MirandaProtocolHandler) );
			container.AddComponent( "protocolhandler.messenger", 
				typeof(IProtocolHandler), typeof(MessengerProtocolHandler) );
			
			// using...

			ILogger logger = (ILogger) container[ typeof(ILogger) ];
			Assert.AreEqual( 0, logger.Contents.Length );

			IProtocolHandler handler = (IProtocolHandler) 
				container[ "protocolhandler.miranda" ];
			handler.Handle( "contents" );

			handler = (IProtocolHandler) container[ "protocolhandler.messenger" ];
			handler.Handle( "contents" );

			Assert.AreEqual( "Entering Handle Leaving Handle Entering Handle Leaving Handle ", 
				logger.Contents );
		}
开发者ID:atczyc,项目名称:castle,代码行数:33,代码来源:ExternalConfigurationTestCase.cs

示例13: DefaultAlias_comes_from_facility

		public void DefaultAlias_comes_from_facility()
		{
			var container = new WindsorContainer();
			container.AddFacility<NHibernateFacility>(f => f.DefaultAlias = "NAX-677");
			var configurationResolver = container.Resolve<IConfigurationResolver>();
			Assert.AreEqual("NAX-677", configurationResolver.DefaultAlias);
		}
开发者ID:matthewc-mps-aust,项目名称:quokka,代码行数:7,代码来源:ConfigurationResolverTests.cs

示例14: StartableComponentShouldNotStartIfExceptionThrownByInstaller

		public void StartableComponentShouldNotStartIfExceptionThrownByInstaller()
		{
			UsesIEmptyService.instancesCreated = 0;
			using (var container = new WindsorContainer())
			{
				container.AddFacility<StartableFacility>(f => f.DeferredStart());
				Assert.Throws<NotImplementedException>(
					() =>
					container.Install(new ActionBasedInstaller(c => c.Register(Component.For<UsesIEmptyService>().Start())),
					                  new ActionBasedInstaller(c => c.Register(Component.For<IEmptyService>().ImplementedBy<EmptyServiceA>())),
					                  new ActionBasedInstaller(c => { throw new NotImplementedException(); })));

				// In this scenario, I've registered IDependencyOfStartableComponent
				// before the ExceptionThrowingInstaller gets a chance to gum up the works
				// I would expect that the "deferred start" code NOT run here, 
				// and the StartableComponent remain un-instantiated.
				// However, Castle is creating the StartableComponent anyway
				// and then allows the NotImplementedException to bubble out.
				// Presumably, this is due to the "deferred start" mechanism
				// being implemented by a using() block or something similar
				// via OptimizeDependencyResolutionDisposable.Dispose()

				Assert.AreEqual(0, UsesIEmptyService.instancesCreated);
			}
		}
开发者ID:castleproject,项目名称:Windsor,代码行数:25,代码来源:StartableAndExceptionThrowingInstallersTestCase.cs

示例15: CanCreateDuplexProxyWithCallbackType

        public void CanCreateDuplexProxyWithCallbackType()
        {
            IWindsorContainer localContainer = new WindsorContainer();

            localContainer.AddFacility<WcfFacility>();

            DuplexClientModel model = new DuplexClientModel
            {
                Endpoint = WcfEndpoint.ForContract<IServiceWithCallback>()
                    .BoundTo(new NetTcpBinding())
                    .At("net.tcp://localhost/ServiceWithCallback")
            }.WithCallback<ICallbackService>();

            localContainer.Register(WcfClient.ForChannels(model));

            localContainer.Register(Component.For<ICallbackService>()
                                        .ImplementedBy<CallbackService>());

            var callbackService = localContainer.Resolve<ICallbackService>();

            Assert.AreEqual(0, ((CallbackService)callbackService).ValueFromTheOtherSide);

            IServiceWithCallback proxy = localContainer.Resolve<IServiceWithCallback>();
            proxy.DoSomething(21);

            Assert.IsAssignableFrom(typeof(CallbackService), callbackService);
            Assert.AreEqual(42, ((CallbackService)callbackService).ValueFromTheOtherSide);
        }
开发者ID:bwegman,项目名称:Castle.Facilities.Wcf,代码行数:28,代码来源:DuplexClientFixture.cs


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