示例#1
0
 private async Task RunSchedule(CancellationToken cancellationToken)
 {
     if (_container == null)
     {
         throw new InvalidOperationException("RunAsync called before OnOpenAsync");
     }
     await ScheduledService <TServiceImplementation> .RunScheduleAsync(_container, cancellationToken);
 }
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            using (ILifetimeScope scope = _container.BeginLifetimeScope(
                       builder => { builder.RegisterInstance(StateManager).As <IReliableStateManager>(); }))
            {
                var impl            = scope.Resolve <TServiceImplementation>();
                var telemetryClient = scope.Resolve <TelemetryClient>();
                var logger          = scope.Resolve <ILogger <DelegatedStatefulService <TServiceImplementation> > >();

                await Task.WhenAll(
                    impl.RunAsync(cancellationToken),
                    ScheduledService.RunScheduleAsync(impl, telemetryClient, cancellationToken, logger));
            }
        }
 private async Task RunSchedule(CancellationToken cancellationToken)
 {
     await ScheduledService <TServiceImplementation> .RunScheduleAsync(_container, cancellationToken);
 }