public override void RunStep(JobResult jobResult) { IStepResult stepResult; try { var previousStepResult = jobResult.StepResults.LastOrDefault() as StepResult <TIn>; if (previousStepResult == null) { throw new NullReferenceException("Could not run step. No previous step result."); } stepResult = StepFunc.DynamicInvoke(previousStepResult.PassingObject) as IStepResult; } catch (Exception ex) { stepResult = new StepResult <TOut>() { IsSuccess = false, EndJob = true, Exception = ex }; } jobResult.StepResults.Add(stepResult); if (stepResult == null || stepResult.EndJob) { jobResult.HasFailed = true; return; } NextStep?.RunStep(jobResult); }
public override void RunStep(JobResult jobResult) { IStepResult stepResult; try { stepResult = StepFunc.DynamicInvoke() as IStepResult; } catch (Exception ex) { stepResult = new StepResult() { IsSuccess = false, EndJob = true, Exception = ex }; } jobResult.StepResults.Add(stepResult); if (stepResult == null || stepResult.EndJob) { jobResult.HasFailed = true; return; } NextStep?.RunStep(jobResult); }