Пример #1
0
 public void Handle(TCommand command)
 {
     using (_dependencyContainer.BeginScope())
     {
         _commandHandler.Handle(command);
     }
 }
Пример #2
0
 private IDependencyContainer CreateContainerScope()
 {
     try
     {
         return(_container.BeginScope(_contextDescriptor.ScopeConfigurator));
     }
     catch (Exception e)
     {
         throw new InvalidOperationException($"Container scope initialization failed: {e.Message}", e);
     }
 }
Пример #3
0
            public async Task <CompositeStepContext> InvokeAsync(object context, object[] args)
            {
                var result = await _invocation.Invoke(context, args);

                if (!(result is CompositeStepResultDescriptor compositeDescriptor))
                {
                    return(CompositeStepContext.Empty);
                }

                var subStepScope    = _container.BeginScope(compositeDescriptor.SubStepsContext.ScopeConfigurator);
                var subStepsContext = InstantiateSubStepsContext(compositeDescriptor.SubStepsContext, subStepScope);

                try
                {
                    return(new CompositeStepContext(subStepScope, _runner.ProvideSteps(_decoratingExecutor, subStepsContext, subStepScope, compositeDescriptor.SubSteps.ToArray(), _groupPrefix)));
                }
                catch (Exception e)
                {
                    throw new InvalidOperationException($"Sub-steps initialization failed: {e.Message}", e);
                }
            }
Пример #4
0
 public IDependencyContainerV2 BeginScope(LifetimeScope scope, Action <ContainerConfigurator> configuration = null)
 {
     return(new WrappingDependencyContainer(_v1.BeginScope(configuration)));
 }