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


C# ITypeProvider.AllHandlerTypes方法代码示例

本文整理汇总了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;
        }
开发者ID:Joshscorp,项目名称:Nimbus,代码行数:30,代码来源:NimbusContainerBuilderExtensions.cs

示例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;
        }
开发者ID:shingi,项目名称:Nimbus,代码行数:28,代码来源:NimbusContainerBuilderExtensions.cs

示例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()));
 }
开发者ID:joshka,项目名称:Nimbus,代码行数:11,代码来源:NimbusNinjectKernelExtensions.cs

示例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;
        }
开发者ID:nhuhuynh,项目名称:Nimbus,代码行数:13,代码来源:NimbusWindsorContainerExtensions.cs

示例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;
        }
开发者ID:mneelakanta,项目名称:Nimbus,代码行数:17,代码来源:NimbusWindsorContainerExtensions.cs

示例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;
        }
开发者ID:Joshscorp,项目名称:Nimbus,代码行数:18,代码来源:NimbusWindsorContainerExtensions.cs


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