本文整理汇总了C#中Castle.Core.Configuration.MutableConfiguration.CreateChild方法的典型用法代码示例。如果您正苦于以下问题:C# MutableConfiguration.CreateChild方法的具体用法?C# MutableConfiguration.CreateChild怎么用?C# MutableConfiguration.CreateChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Castle.Core.Configuration.MutableConfiguration
的用法示例。
在下文中一共展示了MutableConfiguration.CreateChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GlobalJobListeners_with_no_registration_throws
public void GlobalJobListeners_with_no_registration_throws()
{
var c = new WindsorContainer();
var config = new MutableConfiguration("facility");
config.CreateChild("quartz").CreateChild("item", "qwe").Attribute("key", "qq");
config.CreateChild("globalJobListeners").CreateChild("item", "${jobli}");
c.Kernel.ConfigurationStore.AddFacilityConfiguration("quartz", config);
c.AddFacility("quartz", new QuartzFacility());
c.Resolve<IScheduler>();
}
示例2: GlobalJobListeners
public void GlobalJobListeners()
{
var c = new WindsorContainer();
var config = new MutableConfiguration("facility");
config.CreateChild("quartz").CreateChild("item", "qwe").Attribute("key", "qq");
config.CreateChild("globalJobListeners").CreateChild("item", "${jobli}");
c.Kernel.ConfigurationStore.AddFacilityConfiguration("quartz", config);
c.Register(Component.For<IJobListener>().ImplementedBy<SomeJobListener>().Named("jobli"));
c.AddFacility("quartz", new QuartzFacility());
var scheduler = (QuartzNetScheduler)c.Resolve<IScheduler>();
foreach (IJobListener l in scheduler.GlobalJobListeners)
Console.WriteLine(l.Name);
Assert.AreEqual(2, scheduler.GlobalJobListeners.Count);
}
示例3: GlobalTriggerListeners
public void GlobalTriggerListeners()
{
var c = new WindsorContainer();
var config = new MutableConfiguration("facility");
config.CreateChild("quartz").CreateChild("item", "qwe").Attribute("key", "qq");
config.CreateChild("globalTriggerListeners").CreateChild("item", "${jobli}");
c.Kernel.ConfigurationStore.AddFacilityConfiguration("quartz", config);
c.AddComponent("jobli", typeof (ITriggerListener), typeof (SomeTriggerListener));
c.AddFacility("quartz", new QuartzFacility());
var scheduler = c.Resolve<IScheduler>() as QuartzNetScheduler;
foreach (ITriggerListener l in scheduler.GlobalTriggerListeners)
Console.WriteLine(l.Name);
Assert.AreEqual(1, scheduler.GlobalTriggerListeners.Count);
}
示例4: InvalidProtocol_throws
public void InvalidProtocol_throws() {
var configStore = new DefaultConfigurationStore();
var configuration = new MutableConfiguration("facility");
configuration.Attribute("type", typeof(SolrNetFacility).AssemblyQualifiedName);
configuration.CreateChild("solrURL", "ftp://localhost");
configStore.AddFacilityConfiguration(typeof(SolrNetFacility).FullName, configuration);
new WindsorContainer(configStore);
}
示例5: InvalidUrl_throws
public void InvalidUrl_throws() {
var configStore = new DefaultConfigurationStore();
var configuration = new MutableConfiguration("facility");
configuration.Attributes.Add("type", typeof(SolrNetFacility).FullName);
configuration.CreateChild("solrURL", "123");
configStore.AddFacilityConfiguration(typeof(SolrNetFacility).FullName, configuration);
new WindsorContainer(configStore);
}
示例6: ShouldBeAbleToSupplyValueForNullableParamViaCtor_FromConfig
public void ShouldBeAbleToSupplyValueForNullableParamViaCtor_FromConfig()
{
var container = new WindsorContainer();
var configuration = new MutableConfiguration("parameters");
configuration.CreateChild("foo", "5");
container.Register(Component.For<ClassTakingNullableViaCtor>().Configuration(configuration));
container.Resolve<ClassTakingNullableViaCtor>();
}
示例7: CreateModuleConfigurationNode
private IConfiguration CreateModuleConfigurationNode()
{
var config = new MutableConfiguration("array");
foreach (Type type in messageModules)
{
config.CreateChild("item", "${" + type.FullName + "}");
}
return config;
}
示例8: Basic
public void Basic()
{
var c = new WindsorContainer();
var config = new MutableConfiguration("facility");
config.CreateChild("quartz").CreateChild("item", "qwe").Attribute("key", "qq");
c.Kernel.ConfigurationStore.AddFacilityConfiguration("quartz", config);
c.AddFacility("quartz", new QuartzFacility());
c.Resolve<IJobScheduler>();
c.Resolve<IScheduler>();
}
示例9: ParseEndpoints_reflects_entries
public void ParseEndpoints_reflects_entries()
{
var config = new MutableConfiguration("entries");
config.CreateChild("item").Attribute("assembly", "asm1").Attribute("endpoint", "end");
var reg = new RemoteEndpointRegistry();
reg.ParseEndpoints(config);
Assert.AreEqual(1, reg.EntriesCount);
}
示例10: ShouldBeAbleToSupplyValueForNullableParam_FromConfig
public void ShouldBeAbleToSupplyValueForNullableParam_FromConfig()
{
var container = new WindsorContainer();
var configuration = new MutableConfiguration("parameters");
configuration.CreateChild("SomeVal", "5");
container.Register(Component.For<ClassTakingNullable>().Configuration(configuration));
var s = container.Resolve<ClassTakingNullable>();
Assert.IsNotNull(s.SomeVal);
}
示例11: JobListeners
public void JobListeners()
{
var c = new WindsorContainer();
var config = new MutableConfiguration("facility");
config.CreateChild("quartz").CreateChild("item", "qwe").Attribute("key", "qq");
var listenerConfig = config.CreateChild("jobListeners");
listenerConfig
.CreateChild("job")
.Attribute("name", "someJob")
.CreateChild("listener", "${jobli}");
c.Kernel.ConfigurationStore.AddFacilityConfiguration("quartz", config);
c.AddComponent("jobli", typeof (IJobListener), typeof (SomeJobListener));
c.AddFacility("quartz", new QuartzFacility());
var scheduler = c.Resolve<IScheduler>() as QuartzNetScheduler;
foreach (var l in scheduler.JobListenerNames)
Console.WriteLine(l);
var jobli = scheduler.GetJobListener(typeof(SomeJobListener).AssemblyQualifiedName);
Assert.IsNotNull(jobli);
}
示例12: FacilityRegistersReleasingJobListener
public void FacilityRegistersReleasingJobListener()
{
using (var c = new WindsorContainer())
{
var config = new MutableConfiguration("facility");
config.CreateChild("quartz");
c.AddFacility<QuartzFacility>(f => f.Configure(config));
var scheduler = c.Resolve<IScheduler>();
//Assert.IsNotNull(scheduler.GlobalJobListeners);
//Assert.AreEqual(2, scheduler.GlobalJobListeners.Count);
Assert.IsAssignableFrom(typeof(ReleasingJobListener), scheduler.ListenerManager.GetJobListeners()[0]);
}
}
示例13: Ping_Query
public void Ping_Query()
{
var configStore = new DefaultConfigurationStore();
var configuration = new MutableConfiguration("facility");
configuration.Attribute("type", typeof(SolrNetFacility).AssemblyQualifiedName);
configuration.CreateChild("solrURL", "http://localhost:8983/solr");
configStore.AddFacilityConfiguration(typeof(SolrNetFacility).FullName, configuration);
var container = new WindsorContainer(configStore);
var solr = container.Resolve<ISolrOperations<CastleFixture.Document>>();
solr.Ping();
Console.WriteLine(solr.Query(SolrQuery.All).Count);
}
示例14: tt
public void tt()
{
var container = new WindsorContainer();
var facilityConfig = new MutableConfiguration("facility");
var assemblies = facilityConfig.CreateChild("assemblies");
assemblies.CreateChild("item", GetType().Assembly.FullName);
var nhConfig = facilityConfig.CreateChild("config");
AddConfig(nhConfig, Environment.ConnectionDriver, typeof(SQLite20Driver).FullName);
AddConfig(nhConfig, Environment.Dialect, typeof(SQLiteDialect).FullName);
AddConfig(nhConfig, Environment.ConnectionProvider, typeof(DriverConnectionProvider).FullName);
AddConfig(nhConfig, Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName);
AddConfig(nhConfig, Environment.ConnectionString, "Data Source=test.db;Version=3;New=True;");
container.Kernel.ConfigurationStore.AddFacilityConfiguration("ar", facilityConfig);
var arFacility = new ActiveRecordFacility();
container.AddFacility("ar", arFacility);
container.AddFacility<TransactionFacility>();
ActiveRecordStarter.CreateSchema();
container.AddComponent<TransactionalService>();
container.Resolve<TransactionalService>().DoSomething();
Assert.IsFalse(ActiveRecordMediator<Person>.Exists());
}
示例15: Basic
public void Basic()
{
using (var c = new WindsorContainer())
{
var config = new MutableConfiguration("facility");
config.CreateChild("quartz").CreateChild("item", "qwe").Attribute("key", "qq");
c.AddFacility<QuartzFacility>(f => f.Configure(config));
var js = c.Resolve<IJobScheduler>();
var sched = c.Resolve<IScheduler>();
var factory = c.Resolve<IJobFactory>();
Assert.IsTrue(js is QuartzNetSimpleScheduler);
Assert.IsTrue(sched is QuartzNetScheduler);
Assert.IsTrue(factory is WindsorJobFactory);
}
}