Пример #1
0
        protected override Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var services = _serviceProvider.AsModuleServices();

            using (var scope = services.CreateScope())
            {
                return(_handlerDelegate(scope.ServiceProvider, stoppingToken));
            }
        }
Пример #2
0
        protected override Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var services = _serviceProvider.AsModuleServices();

            using (var scope = services.CreateScope())
            {
                var serviceHandler = scope.ServiceProvider.GetRequiredService <TServiceHandler>();
                return(serviceHandler.Execute(stoppingToken));
            }
        }