protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { _logger.LogInformation("Worker3 running at: {time}", DateTimeOffset.Now); _logger.LogWarning($"Count from singleton={_singleMySingletonService.GetCount()}"); _logger.LogWarning($"Count from transient={_transientService.GetCount()}"); await Task.Delay(3000, stoppingToken); } }
public int GetCount() { _logger.LogCritical($"TransientInsideSingleton::GetCount()={_transientService.GetCount()}"); _count++; return(_count); }