Calabonga.PipelineExecutor 2.0.0

dotnet add package Calabonga.PipelineExecutor --version 2.0.0
                    
NuGet\Install-Package Calabonga.PipelineExecutor -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Calabonga.PipelineExecutor" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Calabonga.PipelineExecutor" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Calabonga.PipelineExecutor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Calabonga.PipelineExecutor --version 2.0.0
                    
#r "nuget: Calabonga.PipelineExecutor, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Calabonga.PipelineExecutor@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Calabonga.PipelineExecutor&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Calabonga.PipelineExecutor&version=2.0.0
                    
Install as a Cake Tool

Calabonga.PipelineExecutor

Pipeline pattern implementation. Simple process executor with step-by-step pipeline execution. You can use a Calabonga.PipelineExecutor as a nuget-package in your applications.

How to install

Install a nuget-package, for example something like this:

dotnet add package Calabonga.PipelineExecutor

How to use

  1. You should have a class for pipeline processing. It should implemente IPipelineResult interface as a marker for pipeline. Something like that:
/// <summary>
/// Entity as a context and result for PipelineExecutor
/// </summary>
public class ImageResult : IPipelineResult
{
    public string Name { get; set; } = null!;

    public double Height { get; set; }

    public double Width { get; set; }
}

  1. Than you need create a steps for pipeline executor. This is a example for one of them (pay attention to base class of the ResizeStep, this is important):
public class ResizeStep : PipelineStep<ImageResult>
{
    public override int OrderIndex => 2;

    public override Task<StepResult> ExecuteAsync(
        ImageResult item,
        IPipelineConfiguration<ImageResult> configuration,
        ILogger<PipelineExecutor<ImageResult>> logger,
        CancellationToken cancellationToken)
    {
        item.Height = 100;
        item.Width = 100;

        logger.LogInformation("[PIPELINE] Resize done 100 x 100");

        return Task.FromResult(StepResult.Success());
    }
}
  1. Make sure dependencies registered in your Dependency Container;
// Register PipelineExecutor for ImageResult processing
services.AddScoped<PipelineExecutor<ImageResult>>();

// Register PipelineExecutor a DefaultPipeConfiguration (integrated into nuget) or create a custom 
// see ImagePipelineConfiguration shown below.
services.AddScoped<IPipelineConfiguration<ImageResult>, DefaultPipelineConfiguration<ImageResult>>();

// Register a steps of the PipelineExecutor you created.
// Something like shown below:
services.AddScoped<IPipelineStep<ImageResult>, ResizeStep>();
services.AddScoped<IPipelineStep<ImageResult>, UpdateNameStep>();
services.AddScoped<IPipelineStep<ImageResult>, UppercaseNameStep>();
  1. Custom configuration can be used:
/// <summary>
/// Custom configuration for <see cref="PipelineExecutor{T}"/>
/// with some additional parameters
/// </summary>
public class ImagePipelineConfiguration : IPipelineConfiguration<ImageResult>
{
    private readonly IOptions<AppSettings> _settings;

    public ImagePipelineConfiguration(IOptions<AppSettings> settings)
    {
        _settings = settings;
    }

    /// <summary>
    /// Will be used in <see cref="UpdateNameStep"/>
    /// </summary>
    public string ImageDefaultName => _settings.Value.Name ?? "ImageResult-Name-From-Configuration.png";

    /// <summary>
    /// Strategy for steps executing when manual steps added (<see cref="PipelineExecutor.AdditionalStepStrategy"/>).
    /// </summary>
    public AdditionalStepStrategy AdditionalStepStrategy => AdditionalStepStrategy.Append;

    /// <summary>
    /// Strategy when step operation failed (<see cref="FailedStepStrategy"/>)
    /// </summary>
    public FailedStepStrategy FailedStepStrategy => FailedStepStrategy.NotStopPipeline;
}

If you want to use custom configuration, then you should replace registration in DI-container. Something like that:

// Register PipelineExecutor a DefaultPipeConfiguration (integrated into nuget)
//services.AddScoped<IPipelineConfiguration<ImageResult>, DefaultPipelineConfiguration<ImageResult>>();
//
// Register a Custom PipelineExecutorConfiguration for ImageResult
services.AddScoped<IPipelineConfiguration<ImageResult>, ImagePipelineConfiguration>();

History

2.0.0

  • PipelineConfiguration setup improved
    • IPipelineResult created a marker for object class for IPipelineConfiguration
    • IPipelineContext renmed to IPipelineConfiguration
    • DefaultPipelineContext renamed to DefaultPipelineConfiguration
  • Demo project in solution updated
  • Readme updated

1.1.0

  • Some syntax fixed.

1.0.0

  • First Release
  • More summary added/updated

1.0.0-beta.2

  • Project URL address fixed
  • Repository URL address fixed

1.0.0-beta.1

  • First release.

Screenshots

Console app result shown

image

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 176 10/14/2025
1.1.0 171 10/14/2025
1.0.0 361 6/12/2025
1.0.0-beta.2 276 6/11/2025
1.0.0-beta.1 220 6/9/2025

Pipeline refactored