internal static Container BuildSimpleInjectorServiceProvider(this IServiceCollection serviceCollection) { var container = new Container { Options = { DefaultScopedLifestyle = new AsyncScopedLifestyle() } }; var appBuilder = new FakeApplicationBuilder { ApplicationServices = serviceCollection.BuildServiceProvider() }; serviceCollection.AddSimpleInjector(container); serviceCollection.UseSimpleInjectorAspNetRequestScoping(container); ServiceCollection services = serviceCollection as ServiceCollection; ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(services, validateScopes: true) .UseSimpleInjector(container); return(container); }
internal static Container BuildSimpleInjectorServiceProvider(this IServiceCollection serviceCollection) { var container = new Container { Options = { DefaultScopedLifestyle = new AsyncScopedLifestyle() } }; var appBuilder = new FakeApplicationBuilder { ApplicationServices = serviceCollection.BuildServiceProvider() }; serviceCollection.EnableSimpleInjectorCrossWiring(container); serviceCollection.UseSimpleInjectorAspNetRequestScoping(container); container.AutoCrossWireAspNetComponents(appBuilder); return(container); }