NH.Plumber.Core
1.0.0
See the version list below for details.
dotnet add package NH.Plumber.Core --version 1.0.0
NuGet\Install-Package NH.Plumber.Core -Version 1.0.0
<PackageReference Include="NH.Plumber.Core" Version="1.0.0" />
paket add NH.Plumber.Core --version 1.0.0
#r "nuget: NH.Plumber.Core, 1.0.0"
// Install NH.Plumber.Core as a Cake Addin
#addin nuget:?package=NH.Plumber.Core&version=1.0.0
// Install NH.Plumber.Core as a Cake Tool
#tool nuget:?package=NH.Plumber.Core&version=1.0.0
What is Plumber?
Plumber is a very lightweight pipeline that allow us to add each step of a logic to it and later we can Execute these steps.
Each step can either be a Func<TContext, Func<TContext,Task>, Task>
or an object implementing the IPipeLineStep<TContext>
interface.
Context
Each pipeline should have a context that will be passed to each step of the pipeline. This context can be anything. Each step can modify the context and pass it to the next step.
Next Step
Each step will receive the next step of the pipeline and will be able to call it when it is ready. A Step can also decide to not call the next step and stop the pipeline.
Example
[Fact]
public async Task FibonacciTest()
{
var fibonacciStep = new Func<List<int>, Func<List<int>, Task>, Task>(async (context, next) =>
{
if (context.Count == 0)
context.Add(1);
if (context.Count == 1)
context.Add(1);
context.Add(context[context.Count - 1] + context[context.Count - 2]);
await next(context);
});
var pipeline = new PipeLine<List<int>>();
Enumerable.Range(0, 10).ToList().ForEach(i => pipeline.AddNextStep(fibonacciStep));
var context = new List<int>();
await pipeline.ExecuteAsync(context);
Assert.Equal(new[] { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 }, context.ToArray());
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.