forked from autofac/Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (25 loc) · 1.04 KB
/
Copy pathProgram.cs
File metadata and controls
27 lines (25 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System.Threading.Tasks;
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace AspNetCore3Example
{
public class Program
{
public static async Task Main(string[] args)
{
// The `UseServiceProviderFactory(new AutofacServiceProviderFactory())` call here allows for
// ConfigureContainer to be supported in Startup with
// a strongly-typed ContainerBuilder. If you don't
// have the call to AddAutofac here, you won't get
// ConfigureContainer support. This also automatically
// calls Populate to put services you register during
// ConfigureServices into Autofac.
var host = Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureWebHostDefaults(webHostBuilder => webHostBuilder.UseStartup<Startup>())
.Build();
await host.RunAsync();
}
}
}