/// <summary> /// Inserts an existing pipeline before an existing named pipeline. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="target">The pipeline before which the specified pipeline should be inserted.</param> /// <param name="pipeline">The pipeline to insert.</param> /// <returns>The inserted pipeline.</returns> public static IPipeline InsertBefore(this IPipelineCollection pipelines, string target, IPipeline pipeline) { int index = pipelines.IndexOf(target); if (index < 0) { throw new KeyNotFoundException($"Target pipeline {target} was not found"); } return(pipelines.Insert(index, pipeline)); }
/// <summary> /// Inserts an existing pipeline after an existing named pipeline. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="target">The pipeline after which the specified pipeline should be inserted.</param> /// <param name="pipeline">The pipeline to insert.</param> /// <returns>The inserted pipeline.</returns> public static IPipeline InsertAfter(this IPipelineCollection pipelines, string target, IPipeline pipeline) { int index = pipelines.IndexOf(target); if (index < 0) { throw new KeyNotFoundException($"Target pipeline {target} was not found"); } return(index + 1 < pipelines.Count ? pipelines.Insert(index + 1, pipeline) : pipelines.Add(pipeline)); }