MyTrout.Pipelines.Hosting 4.1.0

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

// Install MyTrout.Pipelines.Hosting as a Cake Tool
#tool nuget:?package=MyTrout.Pipelines.Hosting&version=4.1.0

MyTrout.Pipelines.Hosting

Build Status nuget GitHub stars GitHub forks License: MIT

Quality Gate Status Coverage Maintainability Rating Security Rating Vulnerabilities

Introduction

MyTrout.Pipelines.Hosting provides helper classes to run a pipeline using Microsoft's Generic Host.

MyTrout.Pipelines targets .NET 6.0

For more details on Pipelines, see Pipelines.Core

For more details on Pipelines.Steps, see Pipelines.Steps.Core

Installing via NuGet

Install-Package MyTrout.Pipelines.Hosting

Software dependencies

1. Microsoft.Hosting 6.0.0
2. Microsoft.Hosting.Abstractions 6.0.0
3. MyTrout.Pipelines 3.2.x

All software dependencies listed above use the MIT License.

How do I use Pipelines.Hosting?


    using MyTrout.Pipelines;
    using MyTrout.Pipelines.Hosting;
    using System;
    using System.Linq;
    using System.Threading.Tasks;

    namespace MyTrout.Pipeline.Hosting.Samples
    {
        public class Program
        {
            public static async Task Main(string[] args)
            {

                var host = Host.CreateDefaultBuilder(args)
                                    .UsePipeline(builder => 
                                    {
                                        builder.AddStep<Step1>()
                                                .AddStep<Step2>()
                                                .AddStep<Step3>();
                                    })
                                    .Build();

                //
                // IMPORTANT NOTE FOR DEVELOPERS:
                // 
                // Use StartAsync() to allow the caller to review the PipelineContext after execution.
                //
                await host.StartAsync().ConfigureAwait(false);

                var context = host.Services.GetService<PipelineContext>();

                if(context.Errors.Any())
                {
                    // TODO: Errors have already been logged, do any special error processing here.
                }

                await host.StopAsync().ConfigureAwait(false);

                return 0;
            }
        }
    }
}

How do I use Pipelines.Hosting with different configurations for different instances of the same step.

If Step1 prints the Step1Options value with a trailing space to the Console when each step is called, then the following code will generate "Moe, Larry & Curly ".


    using MyTrout.Pipelines.Core;
    using System;
    using System.Linq;
    using System.Threading.Tasks;

    namespace MyTrout.Pipeline.Hosting.Samples
    {
        public class Program
        {
            public static async Task Main(string[] args)
            {
                // IMPORTANT NOTE FOR DEVELOPERS !
                // 
                // Step Dependencies with context must be defined BEFORE UsePipelines() to load the dependencies correctly.
                //

                var host = Host.CreateDefaultBuilder(args)
                                    .UsePipeline(builder => 
                                    {
                                        builder.AddStep(new StepWithInstance<TestingStep1, Step1Options>("context-1", new Step1Options("Moe,"))
                                            .AddStep(new StepWithInstance<TestingStep1, Step1Options>("context-2", new Step1Options("Larry")))
                                            .AddStep(new StepWithInstance<TestingStep1, Step1Options>("context-3", new Step1Options("&"))
                                            .AddStep(new StepWithInstance<TestingStep1, Step1Options>("context-4", new Step1Options("Curly"))
                                    })
                                    .Build();
                
                // IMPORTANT NOTE FOR DEVELOPERS !
                // 
                // Use StartAsync() to allow the caller to review the PipelineContext after execution.
                //

                await host.StartAsync().ConfigureAwait(false);

                var context = host.Services.GetService<PipelineContext>();

                if(context.Errors.Any())
                {
                    // TODO: Errors have already been logged, do any special error processing here.
                }

                await host.StopAsync().ConfigureAwait(false);

                return 0;
            }
        }
    }
}
Product 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 is compatible.  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. 
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
4.1.0 505 12/6/2022
4.0.0 548 5/5/2022
3.1.0 288 12/26/2021
3.0.0 379 6/26/2021
2.0.2 451 12/16/2020
1.2.0 545 8/9/2020
1.0.0 432 7/23/2020
0.21.0-beta 327 7/17/2020
0.20.0-beta 296 6/26/2020
0.19.0-beta 370 6/25/2020
0.15.1-beta 316 4/25/2020