This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Description
Based on aspnet/DependencyInjection#442
The WebHostBuilder API would take advantage of this by using it as a way to override the default IServiceProvider implementation without returning it directly from the application's Startup class. The wire up could look like this:
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseAutofac() // Replace the built-in IServiceProviderFactory with an autofac impl
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
host.Run();
}
One downside to this is that you don't get direct access to the container APIs in the Startup class (which is part of the benefit besides being able to swap out the default impl).
In the above example, UseAutofac would wire up the IServiceProviderFactory. We could also extend the ConventionBasedStartup to allow authoring a ConfigureContainer method that takes the concrete ContainerBuilder directly:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void ConfigureContainer(ContainerBuilder builder)
{
builder.RegisterInstance(new TaskRepository())
.As<ITaskRepository>();
}
public void Configure(IApplicationBuilder app)
{
app.UseMvc();
}
}