Created
February 21, 2018 09:28
-
-
Save PoisonousJohn/43e5517e36f1da5ded945b8a4e2311d9 to your computer and use it in GitHub Desktop.
Incorrect dependency injection
This file contains hidden or 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 APIService : IAPIService | |
{ | |
private readonly Lazy<ILogger> _logger; | |
public APIService() | |
{ | |
_logger = Services.log; | |
} | |
public string UserId { get; private set; } | |
public void Login() | |
{ | |
_logger.Value.Log("Login started"); | |
UserId = "registeredUser1"; | |
_logger.Value.Log("Login ended"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment