docs: Improved DI documentation (#2407)

This commit is contained in:
Armano den Boef
2022-08-02 11:20:27 +02:00
committed by GitHub
parent 503fa755a0
commit 6fdcf98240
28 changed files with 460 additions and 198 deletions

View File

@@ -0,0 +1,24 @@
public class Program
{
private readonly IServiceProvider _serviceProvider;
public Program()
{
_serviceProvider = CreateProvider();
}
static void Main(string[] args)
=> new Program().RunAsync(args).GetAwaiter().GetResult();
static IServiceProvider CreateProvider()
{
var collection = new ServiceCollection();
//...
return collection.BuildServiceProvider();
}
async Task RunAsync(string[] args)
{
//...
}
}