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


C# ITypeProvider.AllResolvableTypes方法代码示例

本文整理汇总了C#中ITypeProvider.AllResolvableTypes方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeProvider.AllResolvableTypes方法的具体用法?C# ITypeProvider.AllResolvableTypes怎么用?C# ITypeProvider.AllResolvableTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITypeProvider的用法示例。


在下文中一共展示了ITypeProvider.AllResolvableTypes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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.AllResolvableTypes())
                       .Where(t => true)
                       .LifestyleScoped()
                );

            return container;
        }
开发者ID:fenix2222,项目名称:Nimbus,代码行数:15,代码来源:NimbusWindsorContainerExtensions.cs

示例2: RegisterCumulus

        public static IContainer RegisterCumulus(this IContainer container, ITypeProvider typeProvider)
        {

            container.Configure(ctx =>
                                {
                                    ctx.For<IDependencyResolver>().Use<StructuremapDependencyResolver>().Singleton();
                                    ctx.For<ITypeProvider>().Use(typeProvider).Singleton();

                                    typeProvider.AllResolvableTypes()
                                                .ToList()
                                                .ForEach(t => ctx.For(t)
                                                                       .Use(t)
                                                                       .Transient());
                                });

            return container;
        }
开发者ID:AtmosphereMessaging,项目名称:Cumulus,代码行数:17,代码来源:StructuremapContainerExtensions.cs

示例3: RegisterZombus

        public static ContainerBuilder RegisterZombus(this ContainerBuilder builder, ITypeProvider typeProvider)
        {
            builder.RegisterInstance(typeProvider)
                   .As<ITypeProvider>()
                   .SingleInstance();

            builder.RegisterType<AutofacDependencyResolver>()
                   .As<IDependencyResolver>()
                   .SingleInstance();

            typeProvider.AllResolvableTypes().Do(t => builder.RegisterType(t)
                                        .AsSelf()
                                        .InstancePerLifetimeScope())
                        .Done();

            return builder;
        }
开发者ID:Royal-Jay,项目名称:Zombus,代码行数:17,代码来源:ZombusContainerBuilderExtensions.cs

示例4: RegisterNimbus

        public static IBindingRoot RegisterNimbus(this IBindingRoot kernel, ITypeProvider typeProvider)
        {
            kernel.Bind<IDependencyResolver>()
                  .To<NinjectDependencyResolver>()
                  .InSingletonScope();

            kernel.Bind<ITypeProvider>()
                  .ToConstant(typeProvider)
                  .InSingletonScope();

            typeProvider.AllResolvableTypes()
                        .ToList()
                        .ForEach(t => kernel.Bind(t)
                                            .To(t)
                                            .InTransientScope());

            return kernel;
        }
开发者ID:fenix2222,项目名称:Nimbus,代码行数:18,代码来源:NimbusNinjectKernelExtensions.cs

示例5: WithUnityDependencyResolver

        /// <summary>
        ///     Setups up the service bus with the given IUnityContainer and registers the types found in the given type provider.
        /// </summary>
        public static BusBuilderConfiguration WithUnityDependencyResolver(this BusBuilderConfiguration configuration, ITypeProvider typeProvider, IUnityContainer unityContainer)
        {
            var dependencyResolver = new UnityDependencyResolver(unityContainer);

            unityContainer.RegisterInstance<IDependencyResolver>(dependencyResolver);
            unityContainer.RegisterInstance<ITypeProvider>(typeProvider);

            foreach (var resolvedType in typeProvider.AllResolvableTypes())
            {
                unityContainer.RegisterType(resolvedType);
            }

            if (!unityContainer.IsRegistered<ILogger>())
            {
                unityContainer.RegisterInstance<ILogger>(new NullLogger());
            }

            return configuration.WithLogger(unityContainer.Resolve<ILogger>()).WithDependencyResolver(dependencyResolver);
        }
开发者ID:AtmosphereMessaging,项目名称:Cumulus,代码行数:22,代码来源:UnityBusBuilderExtensions.cs


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