本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}
示例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 );
}
示例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);
}
示例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);
}
}
示例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);
}