public WorkflowResult Execute() { var results = new WorkflowResult(); this.db.OpenTransaction(); foreach (var step in this.steps) { // run the step. var resultObj = step.ExecutionMethod.Invoke(step.WorkflowStep, step.BuildArgs(paramsWithValues)); if (resultObj is WorkflowStepResult) { // extract chainable values this.ExtractAvailableParametersFromResult(resultObj, step.StepNumber); // add to result set var stepResult = resultObj as WorkflowStepResult; // add the step to the results results.Results.Add(stepResult); // if the step was not sucessful, break from the running // and rollback the transaction if (!stepResult.Success) { this.db.Rollback(); break; } } } // if they were all successful, commit the transaction. if (results.TotalSuccess) { this.db.SaveChanges(); this.db.CommitTransaction(); } return results; }
public WorkflowResult Execute() { var results = new WorkflowResult(); this.db.OpenTransaction(); foreach (var step in this.steps) { // run the step. var resultObj = step.ExecutionMethod.Invoke(step.WorkflowStep, step.BuildArgs(paramsWithValues)); if (resultObj is WorkflowStepResult) { // extract chainable values this.ExtractAvailableParametersFromResult(resultObj, step.StepNumber); // add to result set var stepResult = resultObj as WorkflowStepResult; // add the step to the results results.Results.Add(stepResult); // if the step was not sucessful, break from the running // and rollback the transaction if (!stepResult.Success) { this.db.Rollback(); break; } } } // if they were all successful, commit the transaction. if (results.TotalSuccess) { this.db.SaveChanges(); this.db.CommitTransaction(); } return(results); }