Created
May 30, 2020 13:59
-
-
Save alimozdemir/1579a04b01cc03b2046ca8b4467bf5b4 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
[ApiController] | |
[Route("[controller]")] | |
public class ServiceController : ControllerBase | |
{ | |
private readonly ITransientService _transientService; | |
private readonly IScopedService _scopedService; | |
private readonly ISingletonService _singletonService; | |
public ServiceController(ITransientService transientService, IScopedService scopedService, ISingletonService singletonService) | |
{ | |
_transientService = transientService; | |
_scopedService = scopedService; | |
_singletonService = singletonService; | |
} | |
[HttpGet("Transient")] | |
public string Transient() | |
{ | |
return _transientService.GetValue(); | |
} | |
[HttpGet("Scoped")] | |
public string Scoped() | |
{ | |
return _scopedService.GetValue(); | |
} | |
[HttpGet("Singleton")] | |
public string Singleton() | |
{ | |
return _singletonService.GetValue(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment