public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req,
            [Inject] ITransientService transientService,
            [Inject] IScopedService scopedService,
            [Inject] ISingletonService singletonService,
            ILogger logger)
        {
            logger.LogInformation("C# HTTP trigger function processed a request.");

            string result = String.Join(Environment.NewLine, new[] {
                $"Transient: {transientService.GetCounter()}",
                $"Scoped: {scopedService.GetCounter()}",
                $"Singleton: {singletonService.GetCounter()}",
            });

            return(new OkObjectResult(result));
        }
Exemple #2
0
 public async Task <int> GetSingletonCounter()
 {
     return(await _singletonService.GetCounter());
 }