public static IEnumerable <object[]> GetContainerAdapters() { yield return(new object[] { (ResolverFactory)(c => { var container = new DefaultServiceContainer(); c(container); return container.Resolve <IServiceResolver>(); }) }); yield return(new object[] { (ResolverFactory)(c => { var container = new LightInjectContainer(); c(new LightInjectAdapter(container)); return container.GetInstance <IServiceResolver>(); }) }); yield return(new object[] { (ResolverFactory)(c => { var container = new SimpleInjectorContainer { Options = { AllowOverridingRegistrations = true } }; c(new SimpleInjectorAdapter(container)); return container.GetInstance <IServiceResolver>(); }) }); yield return(new object[] { (ResolverFactory)(c => { var container = new StructureMapContainer(r => c(new StructureMapAdapter(r))); return container.GetInstance <IServiceResolver>(); }) }); yield return(new object[] { (ResolverFactory)(c => { var containerBuilder = new ContainerBuilder(); c(new AutofacAdapter(containerBuilder)); var container = containerBuilder.Build(); return container.Resolve <IServiceResolver>(); }) }); yield return(new object[] { (ResolverFactory)(c => { var container = new WindsorContainer(); c(new WindsorAdapter(container)); return container.Resolve <IServiceResolver>(); }) }); yield return(new object[] { (ResolverFactory)(c => { var container = new NinjectContainer(); c(new NinjectAdapter(container)); return container.Get <IServiceResolver>(); }) }); #if !NETFX yield return(new object[] { (ResolverFactory)(c => { var serviceCollection = new ServiceCollection(); c(new ServiceCollectionAdapter(serviceCollection)); var serviceProvider = serviceCollection.BuildServiceProvider(true); //validate scopes return serviceProvider.GetService <IServiceResolver>(); }) }); #endif }
protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection) { var container = new LightInject.ServiceContainer(); return(container.CreateServiceProvider(serviceCollection)); }
public LightInjectIOCContainer(LightInject.ServiceContainer underlyingContainer) { this.cntr = underlyingContainer; }