Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created November 11, 2018 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/7d25f2126dc175c7f3ea664316ee9cdb to your computer and use it in GitHub Desktop.
Save christiannagel/7d25f2126dc175c7f3ea664316ee9cdb to your computer and use it in GitHub Desktop.
Configure dependencies with Microsoft.Extensions.DependencyInjection
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