本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}