ASP.NET Core DI
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
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