Ejemplo n.º 1
0
        private void RunNextSessionCommand(int stageIndex, SessionCallContext callContext)
        {
            var stage = Stages[stageIndex];

            // it's important that all Stages get an opportunity to perform every session command - hence the exception handling here...
            try
            {
                callContext.SessionCommand(stage);
            }
            catch (Exception ex)
            {
                callContext.Exceptions.Add(ex);
            }
            if (++stageIndex < Stages.Count)
            {
                RunNextSessionCommand(stageIndex, callContext);
            }
            try
            {
                callContext.PostSessionCommand(stage);
            }
            catch (Exception ex)
            {
                callContext.Exceptions.Add(ex);
            }
        }
Ejemplo n.º 2
0
 private void RunSessionCommand(string typeOfSessionCommand, Action <IPipelineStage> sessionCommand, Action <IPipelineStage> postSessionCommand)
 {
     if (Stages.Any())
     {
         var callContext = new SessionCallContext(sessionCommand, postSessionCommand);
         RunNextSessionCommand(0, callContext);
         if (callContext.Exceptions.Any())
         {
             throw new AggregateException(string.Format("One or more Stages failed to successfully execute {0}Session", typeOfSessionCommand), callContext.Exceptions);
         }
     }
 }