/// <summary> /// Runs processors of <paramref name="enumerable"/> one by one /// with a specified <see cref="Runner"/> instance. /// </summary> /// <typeparam name="TArgs"> /// Type of arguments to be passed in each processor. /// </typeparam> /// <param name="enumerable"> /// Enumerable object of <see cref="IProcessor"/> to be /// executed one by one with a specified <see cref="Runner"/>. /// </param> /// <param name="args">Arguments to be passed in each processor.</param> /// <param name="runner"> /// Pipeline runner instance which will be used /// to execute collection of processors. /// </param> /// <returns> /// Returns <see cref="Task"/> object, which indicates a status /// of execution of processors. /// </returns> public static async Task Run(this IEnumerable <IProcessor> enumerable, Bag args, IProcessorRunner runner) { runner = runner ?? Runner.Instance; if (enumerable.HasNoValue()) { return; } foreach (var processor in enumerable) { await runner.Run(processor, args).ConfigureAwait(false); } }
/// <summary> /// Runs a processor with <paramref name="args"/> context /// and <paramref name="runner"/>. /// </summary> /// <param name="processor"> /// The processor to be executed. It will be executed /// by <see cref="IProcessorRunner.Run{TArgs}"/> /// method with <paramref name="args"/> passed. /// </param> /// <param name="args"> /// The context which will be passed to the processor during execution. /// </param> /// <param name="runner"> /// The runner which will be used to run the processor. /// </param> /// <returns> /// The task object indicating the status of an executing pipeline. /// </returns> public static Task Run(this IProcessor processor, Bag args = null, IProcessorRunner runner = null) { runner = runner ?? Runner.Instance; args = args ?? new Bag(); return(runner.Run(processor, args)); }