本文整理汇总了C#中ITypeProvider.AllHandlerTypes方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeProvider.AllHandlerTypes方法的具体用法?C# ITypeProvider.AllHandlerTypes怎么用?C# ITypeProvider.AllHandlerTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeProvider
的用法示例。
在下文中一共展示了ITypeProvider.AllHandlerTypes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterNimbus
public static ContainerBuilder RegisterNimbus(this ContainerBuilder builder, ITypeProvider typeProvider)
{
foreach (var handlerType in typeProvider.AllHandlerTypes())
{
var handlerInterfaceTypes = handlerType.GetInterfaces().Where(typeProvider.IsClosedGenericHandlerInterface);
foreach (var interfaceType in handlerInterfaceTypes)
{
builder.RegisterType(handlerType)
.Named(handlerType.FullName, interfaceType)
.InstancePerLifetimeScope();
}
}
builder.RegisterSource(new ContravariantRegistrationSource());
typeProvider.InterceptorTypes
.Do(t => builder.RegisterType(t)
.AsSelf()
.InstancePerLifetimeScope())
.Done();
builder.RegisterInstance(typeProvider)
.AsImplementedInterfaces()
.SingleInstance();
builder.RegisterType<AutofacDependencyResolver>()
.As<IDependencyResolver>()
.SingleInstance();
return builder;
}
示例2: RegisterNimbus
public static ContainerBuilder RegisterNimbus(this ContainerBuilder builder, ITypeProvider typeProvider)
{
builder.RegisterTypes(typeProvider.AllHandlerTypes())
.AsImplementedInterfaces()
.InstancePerLifetimeScope();
builder.RegisterType<AutofacMulticastEventHandlerFactory>()
.AsImplementedInterfaces()
.SingleInstance();
builder.RegisterType<AutofacCompetingEventHandlerFactory>()
.AsImplementedInterfaces()
.SingleInstance();
builder.RegisterType<AutofacCommandHandlerFactory>()
.AsImplementedInterfaces()
.SingleInstance();
builder.RegisterType<AutofacRequestHandlerFactory>()
.AsImplementedInterfaces()
.SingleInstance();
builder.RegisterType<AutofacMulticastRequestHandlerFactory>()
.AsImplementedInterfaces()
.SingleInstance();
return builder;
}
示例3: BindAllHandlerInterfaces
private static void BindAllHandlerInterfaces(IBindingRoot kernel, ITypeProvider typeProvider)
{
typeProvider.AllHandlerTypes()
.ToList()
.ForEach(
handlerType =>
handlerType.GetInterfaces()
.Where(typeProvider.IsClosedGenericHandlerInterface)
.ToList()
.ForEach(interfaceType => kernel.Bind(interfaceType).To(handlerType).InTransientScope()));
}
示例4: RegisterNimbus
public static IWindsorContainer RegisterNimbus(this IWindsorContainer container, ITypeProvider typeProvider)
{
container.Register(
Classes.From(typeProvider.AllHandlerTypes()).Pick().WithServiceAllInterfaces().LifestyleScoped(),
Component.For<IMulticastEventBroker>().ImplementedBy<WindsorMulticastEventBroker>().LifestyleSingleton(),
Component.For<ICompetingEventBroker>().ImplementedBy<WindsorCompetingEventBroker>().LifestyleSingleton(),
Component.For<ICommandBroker>().ImplementedBy<WindsorCommandBroker>().LifestyleSingleton(),
Component.For<IRequestBroker>().ImplementedBy<WindsorRequestBroker>().LifestyleSingleton(),
Component.For<IMulticastRequestBroker>().ImplementedBy<WindsorMulticastRequestBroker>().LifestyleSingleton()
);
return container;
}
示例5: RegisterNimbus
public static IWindsorContainer RegisterNimbus(this IWindsorContainer container, ITypeProvider typeProvider)
{
container.Register(
Component.For<IDependencyResolver>().ImplementedBy<WindsorDependencyResolver>().LifestyleSingleton(),
Component.For<ITypeProvider>().Instance(typeProvider).LifestyleSingleton()
);
container.Register(
Classes.From(typeProvider.AllHandlerTypes())
.Where(t => true)
.WithServiceSelect((t, bt) => SelectHandlerInterfaces(t, typeProvider))
.Configure(ConfigureComponent)
.LifestyleScoped()
);
return container;
}
示例6: RegisterNimbus
public static IWindsorContainer RegisterNimbus(this IWindsorContainer container, ITypeProvider typeProvider)
{
container.Register(
Component.For<IDependencyResolver>().ImplementedBy<WindsorDependencyResolver>().LifestyleSingleton(),
Component.For<ITypeProvider>().Instance(typeProvider).LifestyleSingleton()
);
foreach (var handlerType in typeProvider.AllHandlerTypes())
{
var handlerInterfaceTypes = handlerType.GetInterfaces().Where(typeProvider.IsClosedGenericHandlerInterface);
foreach (var interfaceType in handlerInterfaceTypes)
{
container.Register(Component.For(interfaceType).ImplementedBy(handlerType).Named(handlerType.FullName).LifestyleScoped());
}
}
return container;
}