本文整理汇总了C#中IKernel.AddFacility方法的典型用法代码示例。如果您正苦于以下问题:C# IKernel.AddFacility方法的具体用法?C# IKernel.AddFacility怎么用?C# IKernel.AddFacility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKernel
的用法示例。
在下文中一共展示了IKernel.AddFacility方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
/// <summary>
/// Registers the facility to the container
/// </summary>
/// <param name="kernel"></param>
public void Register(IKernel kernel)
{
var facilityConfiguration = configuration.Build();
string facilityId = facilityConfiguration.Attributes["id"];
kernel.ConfigurationStore.AddFacilityConfiguration(facilityId, facilityConfiguration);
kernel.AddFacility<NHibernateFacility>(facilityId);
}
示例2: Execute
/// <summary>
/// Executes task.
/// </summary>
/// <param name="application">The application.</param>
/// <param name="kernel">IoC container.</param>
public void Execute(IApplication application, IKernel kernel)
{
var facilityConfig = GetFacilityConfig(application);
kernel.ConfigurationStore.AddFacilityConfiguration("nhibernate.facility", facilityConfig);
kernel.AddFacility("nhibernate.facility", new NHibernateFacility(new NHibernateConfigurator(application, kernel)));
}
示例3: Setup
public void Setup()
{
kernel = new DefaultKernel();
kernel.AddFacility<MethodValidatorFacility>();
kernel.Register(Component.For<IOrderService>().ImplementedBy<OrderService>());
//Add the WindsorContainer so we have an IProxyFactory instance
WindsorContainer container = new WindsorContainer(kernel, new DefaultComponentInstaller());
}
示例4: CastleAspectContainer
/// <summary>
/// Initializes a new instance of the <see cref="CastleAspectContainer"/> class.
/// </summary>
/// <param name="container">The container.</param>
public CastleAspectContainer(IKernel container)
{
Proxy = new MasterProxy {Container = new WindsorServiceLocatorAdapter(container)};
_kernel = container;
_kernel.Register(Component.For(GetType()).Named("CastleAspectContainer").Instance(this));
_kernel.Register(Component.For(Proxy.GetType())/*.Named("MasterProxy")*/.Instance(Proxy));
_kernel.AddFacility<CastleAspectFacility>();
_kernel.Register(Component.For<PseudoInterceptor>());
}
示例5: CastleAspectContainer
/// <summary>
/// Initializes a new instance of the <see cref="CastleAspectContainer"/> class.
/// </summary>
/// <param name="container">The container.</param>
public CastleAspectContainer(IKernel container)
{
Proxy = new MasterProxy();
_kernel = container;
_kernel.Register(Component.For(this.GetType()).Named("CastleAspectContainer").Instance(this));
_kernel.Register(Component.For(Proxy.GetType()).Named("MasterProxy").Instance(Proxy));
_kernel.AddFacility<CastleAspectFacility>();
_kernel.Register(Component.For<PseudoInterceptor>());
}
示例6: Register
public virtual void Register(IKernel kernel)
{
kernel.AddFacility<TypedFactoryFacility>();
kernel.Register(Component.For<IViewModelFactory>().AsFactory());
kernel.Register(Component.For<IDialogFactory>().AsFactory());
kernel.Register(AllTypes.FromAssemblyContaining<ViewModelRegistration>()
.Where(t => t.Namespace == "Rhino.Licensing.AdminTool.Factories")
.WithService.FirstInterfaceOnClass());
}
示例7: Init
public void Init()
{
_kernel = new DefaultKernel();
IConfiguration confignode = new MutableConfiguration("facility");
IConfiguration facilityConf = confignode.Children.Add(new MutableConfiguration(FacilityKey));
_kernel.ConfigurationStore.AddFacilityConfiguration(FacilityKey, confignode);
_facility = new HiperFacility();
Assert.IsFalse(_facility.Initialized);
_kernel.AddFacility(FacilityKey, _facility);
}
示例8: SetUp
public void SetUp()
{
kernel = new DefaultKernel();
kernel.AddFacility<StartableFacility>();
kernel.Register(
Component.For<StartableDisposableAndInitializableComponent>()
.LifeStyle.Transient
);
component = kernel.Resolve<StartableDisposableAndInitializableComponent>();
component.DoSomething();
kernel.ReleaseComponent(component);
calledMethods = component.calledMethods;
}
示例9: Init
public void Init()
{
facility = new FactorySupportFacility();
kernel = new DefaultKernel();
kernel.AddFacility("factory.support", facility);
}
示例10: SetUp
public void SetUp()
{
kernel = new DefaultKernel();
kernel.AddFacility<FactorySupportFacility>();
}