Skip to content

Instantly share code, notes, and snippets.

@NikitaChizhov
Created February 11, 2020 19:46
Show Gist options
  • Save NikitaChizhov/42f8b19f0007f8d1183bdc88090292e8 to your computer and use it in GitHub Desktop.
Save NikitaChizhov/42f8b19f0007f8d1183bdc88090292e8 to your computer and use it in GitHub Desktop.
internal sealed class ExampleServiceClassicDecorator : IExampleService
{
private readonly IExampleService _decorated;
private readonly ILogger<ExampleServiceClassicDecorator> _logger;
public ExampleServiceClassicDecorator(IExampleService decorated,
ILogger<ExampleServiceClassicDecorator> logger)
{
_decorated = decorated;
_logger = logger;
}
/// <inheritdoc />
public async Task VeryImportantWorkAsync(int additionalSecondsToWait)
{
_logger.LogInformation("Log something before method call");
await _decorated.VeryImportantWorkAsync(additionalSecondsToWait);
_logger.LogInformation("Log something after method competition.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment