public ICommandContext EstablishForCommand(ICommand command) { if (!IsInContext(command)) { var commandContext = _factory.Build(command); CurrentContext = commandContext; } return(CurrentContext); }
/// <inheritdoc/> public ICommandContext EstablishForCommand(CommandRequest command) { _logger.Debug("Establishing command context for command '{CommandType}' with correlation '{CorrelationId}'", command.Type, command.CorrelationId); if (!IsInContext(command)) { _executionContextManager.CurrentFor(_executionContextManager.Current.Tenant, command.CorrelationId); _currentContext.Value = _factory.Build(command); } else { _executionContextManager.CurrentFor(_currentContext.Value.ExecutionContext); } return(_currentContext.Value); }