-
-
Save christiannagel/7d25f2126dc175c7f3ea664316ee9cdb to your computer and use it in GitHub Desktop.
Configure dependencies with Microsoft.Extensions.DependencyInjection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void RegisterServices(IConfiguration configuration) | |
{ | |
var services = new ServiceCollection(); | |
services.AddLogging(builder => | |
{ | |
builder.AddConfiguration(configuration.GetSection("Logging")) | |
.AddConsole(); | |
#if DEBUG | |
builder.AddDebug(); | |
#endif | |
}); | |
services.AddHttpClient<SampleController>(); | |
AppServices = services.BuildServiceProvider(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment