Esempio n. 1
0
 public RunScript(RunScript source) : base()
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     Script = source.Script;
 }
Esempio n. 2
0
        private async Task Handle(RunScript script, IContext context)
        {
            foreach (ScriptCommand scriptCommand in script.Script.Commands)
            {
                using (TransactionScope scope = new TransactionScope(_services, context)) {
                    scope
                    .Context
                    .Set(new RequestTimeContext(DateTime.Now), true);

                    Command command = new Command(
                        scriptCommand.ID,
                        scriptCommand.Message,
                        scriptCommand.Target);

                    QueueCommandResult result = await _services
                                                .Send <QueueCommand, Task <QueueCommandResult> >(new QueueCommand(command, scope.Context))
                                                .To <ICommandProcessor>();

                    await result.Completion;
                }
            }
        }