Created
February 11, 2020 20:04
-
-
Save NikitaChizhov/073eec647a8782e206e5939f813635c0 to your computer and use it in GitHub Desktop.
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
void ConfigureServices(IServiceCollection services) | |
{ | |
services | |
.AddLogging(configure => | |
{ | |
configure.AddConsole(); | |
configure.SetMinimumLevel(LogLevel.Information); | |
}) | |
.AddSingleton<IImportantDataProvider, ImportantDataProvider>() | |
.AddSingleton<IExampleService>(sp => | |
{ | |
var service = new ExampleService(sp.GetRequiredService<IImportantDataProvider>()); | |
var decorated = new ExampleServiceClassicDecorator(service, | |
sp.GetRequiredService<ILogger<ExampleServiceClassicDecorator>>()); | |
return decorated; | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment