public void Handle(TCommand command) { using (_dependencyContainer.BeginScope()) { _commandHandler.Handle(command); } }
private IDependencyContainer CreateContainerScope() { try { return(_container.BeginScope(_contextDescriptor.ScopeConfigurator)); } catch (Exception e) { throw new InvalidOperationException($"Container scope initialization failed: {e.Message}", e); } }
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); } }
public IDependencyContainerV2 BeginScope(LifetimeScope scope, Action <ContainerConfigurator> configuration = null) { return(new WrappingDependencyContainer(_v1.BeginScope(configuration))); }