Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ASP.NET Core DI
public class MyConnectionManager : IMyConnectionManager
{
private readonly ILogger<MyConnectionManager> _logger;
private readonly IMyScopedService _myScopedService;
public MyConnectionManager(ILogger<MyConnectionManager> logger, IMyScopedService myScopedService)
{
_logger = logger;
_myScopedService = myScopedService;
}
public void DoSomething()
{
_logger.LogInformation( $"{nameof(MyConnectionManager)} does something");
_logger.LogInformation( $"Calling {nameof(MyScopedService)}.{nameof(MyScopedService.DoSomething)}");
_myScopedService.DoSomething();
}
}
public interface IMyConnectionManager
{
void DoSomething();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.