private void DispatchInternal(IEnumerable <CommandBase> commands, HashSet <string> usedChannels)
        {
            foreach (var commandBase in commands)
            {
                if (!(commandBase is ITracingOnly))
                {
                    if (!usedChannels.Contains(commandBase.ChannelId))
                    {
                        usedChannels.Add(commandBase.ChannelId);
                    }
                    var r    = _mx.GetRunner(commandBase);
                    var tran = _transactionManager.GetCommandTransaction(commandBase.ChannelId, commandBase, false);

                    try
                    {
                        r.RunInternal(commandBase);
                        commandBase.IsExecuted = true;
                        tran.Commit();
                    }
                    catch (Exception e)
                    {
                        throw new TectureCommandRunException(commandBase, e);
                    }
                    finally
                    {
                        tran.Dispose();
                    }
                }
            }
        }
        private void RunCommands(IEnumerable <CommandBase> commands, HashSet <string> usedChannels)
        {
            foreach (var commandBase in commands)
            {
                if (!(commandBase is ITracingOnly))
                {
                    if (!usedChannels.Contains(commandBase.ChannelId))
                    {
                        usedChannels.Add(commandBase.ChannelId);
                    }
                    var       r    = _mx.GetRunner(commandBase);
                    var       tran = _transactionManager.GetCommandTransaction(commandBase.ChannelId, commandBase, false);
                    Stopwatch sw   = null;
                    if (_traceCollector != null && _traceCollector.Profiling)
                    {
                        sw = new Stopwatch();
                        sw.Start();
                    }

                    try
                    {
                        r.RunInternal(commandBase);
                        commandBase.IsExecuted = true;
                        tran.Commit();
                    }
                    catch (Exception e)
                    {
                        commandBase.Exception = e;
                        throw new TectureCommandRunException(commandBase, e);
                    }
                    finally
                    {
                        tran.Dispose();
                        if (_traceCollector != null && _traceCollector.Profiling)
                        {
                            sw?.Stop();
                            commandBase.TimeTaken = sw?.Elapsed ?? TimeSpan.Zero;
                        }
                    }
                }
            }
        }