VersaTul.Pipeline.Infrastructure 1.0.14

Prefix Reserved
dotnet add package VersaTul.Pipeline.Infrastructure --version 1.0.14                
NuGet\Install-Package VersaTul.Pipeline.Infrastructure -Version 1.0.14                
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="VersaTul.Pipeline.Infrastructure" Version="1.0.14" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VersaTul.Pipeline.Infrastructure --version 1.0.14                
#r "nuget: VersaTul.Pipeline.Infrastructure, 1.0.14"                
#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.
// Install VersaTul.Pipeline.Infrastructure as a Cake Addin
#addin nuget:?package=VersaTul.Pipeline.Infrastructure&version=1.0.14

// Install VersaTul.Pipeline.Infrastructure as a Cake Tool
#tool nuget:?package=VersaTul.Pipeline.Infrastructure&version=1.0.14                

VersaTul Pipeline Infrastructure

VersaTul Pipeline Infrastructure is a C# library that provides a generic implementation of the Pipeline pattern. The Pipeline pattern is a useful and neat way to perform a series of filtering or processing steps on an object to transform it into a desired state.

Installation

To use VersaTul Pipeline Infrastructure, first install it using nuget:

PM> NuGet\Install-Package VersaTul.Pipeline.Infrastructure -Version latest

Usage

The library consists of two main components: IStep<TIn, TOut> and Pipeline<TIn, TOut>.

  • IStep<TIn, TOut> : A step represents the work to be done on a given input with the given return type. It has a single method:
TOut Execute (TIn input);
  • Pipeline<TIn, TOut> : IStep<TIn, TOut> : Represents an accumulative set of steps that can be performed on a given input. It has a single property:
Func<TIn, TOut> Step;

The library also provides a static class PipelineExtensions that contains extension methods for adding steps to objects and pipelines.

TOut AddStep<TIn, TOut> (this TIn input, IStep<T, U> step);

Example

The following code shows how to use nested pipelines to work with different types.

// Using nested pipeline to work with different types.
// Example pipeline with steps setup.
public class CompoundPipeline : Pipeline<int, string>
{
    public CompoundPipeline()
    {
        Step = input => input
            .AddStep(new AnInitialStep())
            .AddStep(new InnerPipeline()) //InnerPipeline used by CompoundPipeline
            .AddStep(new IntToStringStep())
            .AddStep(new DoSomethingWithAStringStep());
    }
}

// A Pipeline that's called by another pipeline.
public class InnerPipeline : Pipeline<string, int>
{
    public InnerPipeline()
    {
        Step = input => input
            .AddStep(new DoSomethingWithAnIntegerStep())
            .AddStep(new SomethingElseWithAnIntegerStep())
            .AddStep(new OptionalStep<int, int>(i => i > 5, new AddOneStep()));
    }
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on VersaTul.Pipeline.Infrastructure:

Package Downloads
VersaTul.Display.Attributes

The VersaTul Display Attributes project enables the ability to provide meta-data to the export engine for outputting collections as files. This package works with the Collection streamers package. Attributes can be applied to the properties of a collection data type in order to manipulate the outputted data.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.14 929 2/25/2024
1.0.10 133 2/25/2024
1.0.9 122 2/25/2024
1.0.8 341 2/1/2024
1.0.7 751 1/15/2024
1.0.6 586 1/10/2024
1.0.5 982 7/22/2023