VersaTul.Pipeline.Infrastructure
1.0.19
Prefix Reserved
See the version list below for details.
dotnet add package VersaTul.Pipeline.Infrastructure --version 1.0.19
NuGet\Install-Package VersaTul.Pipeline.Infrastructure -Version 1.0.19
<PackageReference Include="VersaTul.Pipeline.Infrastructure" Version="1.0.19" />
paket add VersaTul.Pipeline.Infrastructure --version 1.0.19
#r "nuget: VersaTul.Pipeline.Infrastructure, 1.0.19"
// Install VersaTul.Pipeline.Infrastructure as a Cake Addin #addin nuget:?package=VersaTul.Pipeline.Infrastructure&version=1.0.19 // Install VersaTul.Pipeline.Infrastructure as a Cake Tool #tool nuget:?package=VersaTul.Pipeline.Infrastructure&version=1.0.19
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 | Versions 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. |
-
net8.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on VersaTul.Pipeline.Infrastructure:
Package | Downloads |
---|---|
VersaTul.Extensions
The VersaTul Extensions project provides a variety of methods for manipulating arrays, performing conversions and other common functionalities. |
|
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. |
|
VersaTul.Object.Converters
The VersaTul Object Converters project provides the ability to convert objects into key/value pairs dictionary stores. For example, converters can be used to convert instance of classes into a dictionary representation of the data from the class. This package works with the Collection streamers package. |
GitHub repositories
This package is not used by any popular GitHub repositories.