Pipeline Infrastructure
Overview
VersaTul.Pipeline.Infrastructure provides a lightweight implementation of the pipeline-and-step pattern for transforming values through composable processing units.
The package is intentionally small: a step interface, a pipeline base class, and extension methods that make chained step composition easy for both synchronous and asynchronous workflows.
When To Use This Package
Use this package when you want to:
Break a multi-stage transformation into explicit reusable steps.
Chain sync or async processing with clear input and output types.
Add optional diagnostics around step execution time and failures.
Reuse the same pipeline pattern across formatters, validation, or normalization flows.
Installation
Install the package with the .NET CLI:
dotnet add package VersaTul.Pipeline.Infrastructure
Or with the Package Manager Console:
PM> NuGet\Install-Package VersaTul.Pipeline.Infrastructure -Version latest
Core Types And Concepts
IStep<TIn, TOut>Defines a single unit of work that transforms
TInintoTOut.Pipeline<TIn, TOut>Base class for composing a pipeline through a
Func<TIn, TOut>step chain.PipelineExtensionsExtension methods that chain steps fluently and add optional diagnostics.
Key Capabilities
Compose nested pipelines with strongly typed step boundaries.
Execute synchronous steps through
AddStep().Execute asynchronous steps through
AddStep()overloads that returnTask<TOut>.Capture elapsed time and exceptions through diagnostics callbacks.
Fail fast when a pipeline is executed before its step chain is configured.
Step Example
using VersaTul.Pipeline.Infrastructure.Contracts;
public class AddOneStep : IStep<int, int>
{
public int Execute(int input) => input + 1;
}
public class IntToStringStep : IStep<int, string>
{
public string Execute(int input) => input.ToString();
}
Pipeline Example
using VersaTul.Pipeline.Infrastructure;
using VersaTul.Pipeline.Infrastructure.Extensions;
public class NumberPipeline : Pipeline<int, string>
{
public NumberPipeline()
{
Step = input => input
.AddStep(new AddOneStep())
.AddStep(new IntToStringStep());
}
}
Diagnostics Example
var value = 5.AddStep(new AddOneStep(), (elapsed, error) =>
{
Console.WriteLine($"Elapsed: {elapsed}");
if (error != null)
{
Console.WriteLine(error.Message);
}
});
Notes
Pipeline<TIn, TOut>.Execute()throws ifStepis not configured.Async support is provided through
PipelineExtensionsoverloads rather than a separate async pipeline base class.This package is deliberately minimal, which makes it a good fit for custom domain pipelines without framework overhead.