/// <summary> /// Process pipeline stages. /// </summary> /// <param name="item">The item for execution.</param> /// <returns></returns> public virtual bool Execute(T item) { OnPipelineStart?.Invoke(item); foreach (var stage in _stages) { var result = stage.Execute(item); OnStageExecuted?.Invoke(stage.GetType(), item, result); if (result == false) { return(false); } } OnPipelineEnd?.Invoke(item); return(true); }
/// <summary> /// Process pipeline stages. /// </summary> /// <param name="item">The item for execution.</param> /// <returns></returns> public bool Execute(T item) { OnPipelineStart?.Invoke(item); foreach (var stage in _stages) { var result = stage.Execute(item); OnStageExecuted?.Invoke(stage.GetType(), item, result); if (result) { continue; } ErrorResult = stage.ErrorResult; return(false); } OnPipelineEnd?.Invoke(item); return(true); }