示例#1
0
        /// <inheritdoc/>
        public virtual async Task StopAsync(
            CancellationToken cancellationToken)
        {
            using var serviceScope = _serviceScopeFactory.CreateScope();
            DependencyInjectionLogMessages.ServiceScopeCreated(_logger, serviceScope);

            await OnStoppingAsync(
                serviceScope.ServiceProvider,
                cancellationToken);
        }
示例#2
0
        public async Task StartAsync(
            CancellationToken cancellationToken)
        {
            using var logScope = HostingLogMessages.BeginStartupActionScope(_logger, this);
            HostingLogMessages.StartupActionExecuting(_logger);

            using var serviceScope = _serviceScopeFactory.CreateScope();
            DependencyInjectionLogMessages.ServiceScopeCreated(_logger, serviceScope);

            await OnStartingAsync(
                serviceScope.ServiceProvider,
                cancellationToken);

            HostingLogMessages.StartupActionExecuted(_logger);
            _whenDone.SetResult(null);
        }