private Task ExecuteFlow(CancellationToken stoppingToken) { return(Task.Run(() => { _logger.LogInformation("{self} - app flow started at: {time}", this, DateTimeOffset.Now); _appFlowContext.Clear(); using (var serviceTaskCollection = AppTaskCollection.CreateRoot(_serviceProvider, stoppingToken, _configureDelegate)) { serviceTaskCollection.Run(_appFlowContext); } _logger.LogInformation("{self} - app flow finished successfuly at: {time}", this, DateTimeOffset.Now); })); }
private Task ExecuteFlow(CancellationToken stoppingToken) { return(Task.Run(() => { while (!stoppingToken.IsCancellationRequested) { // see if the user pressed Ctrl+C stoppingToken.ThrowIfCancellationRequested(); _logger.LogInformation("{self} - running service flow cycle: {cycleCounter}", this, ++_cycleCounter); _appFlowContext.Clear(); using (var serviceTaskCollection = AppTaskCollection.CreateRoot(_serviceProvider, stoppingToken, _configureDelegate)) { serviceTaskCollection.Run(_appFlowContext); } } })); }