ESCd.Extensions.OperationInvoker 1.0.3-rc.0.2

This is a prerelease version of ESCd.Extensions.OperationInvoker.
dotnet add package ESCd.Extensions.OperationInvoker --version 1.0.3-rc.0.2                
NuGet\Install-Package ESCd.Extensions.OperationInvoker -Version 1.0.3-rc.0.2                
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="ESCd.Extensions.OperationInvoker" Version="1.0.3-rc.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ESCd.Extensions.OperationInvoker --version 1.0.3-rc.0.2                
#r "nuget: ESCd.Extensions.OperationInvoker, 1.0.3-rc.0.2"                
#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 ESCd.Extensions.OperationInvoker as a Cake Addin
#addin nuget:?package=ESCd.Extensions.OperationInvoker&version=1.0.3-rc.0.2&prerelease

// Install ESCd.Extensions.OperationInvoker as a Cake Tool
#tool nuget:?package=ESCd.Extensions.OperationInvoker&version=1.0.3-rc.0.2&prerelease                

ESCd.Extensions.OperationInvoker

Version

A lightweight CQRS-like service pattern.

Basic Usage

  1. Define an Operation:
public static class WeatherOperation
{
    public record GetForecast : IOperation<WeatherForecast[]>;
}
  1. Handle the Operation:
internal sealed class GetForecastHandler : IOperationHandler<WeatherOperation.GetForecast, WeatherForecast[]>
{
    public async Task<WeatherForecast[]> Invoke( WeatherOperation.GetForecast operation, CancellationToken cancellation )
    {
        ArgumentNullException.ThrowIfNull( operation );

        return ...;
    }
}
  1. Add the Handler:
public static IServiceCollection AddOperations(this IServiceCollection services)
    => services.AddOperationHandler<GetForecastHandler>();
  1. Invoke the Operation:
public sealed class WeatherController
{
    [HttpGet("/api/weather")]
    public async Task<ActionResult> Weather([FromServices] IOperationInvoker operations )
    {
        var forecast = await operations.Invoke(
            new WeatherOperation.GetForecast(),
            HttpContext.RequestAborted);

        return Ok(forecast);
    }
}

Something missing, still have questions? Please open an Issue or submit a PR!

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.  net9.0 is compatible. 
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
1.0.3-rc.0.2 32 11/15/2024
1.0.3-rc.0.1 32 11/14/2024
1.0.2 69 11/13/2024
1.0.2-rc.0.2 46 11/12/2024
1.0.1 61 10/8/2024
1.0.1-rc.0.1 48 9/30/2024
1.0.0 57 9/23/2024
1.0.0-rc.0.34 39 9/23/2024
1.0.0-rc.0.33 64 9/11/2024
1.0.0-rc.0.32 50 9/11/2024
1.0.0-rc.0.31 51 9/11/2024
1.0.0-rc.0.26 53 9/5/2024
1.0.0-rc.0.25 48 9/5/2024
1.0.0-rc.0.24 49 9/5/2024
1.0.0-rc.0.23 47 9/4/2024
1.0.0-rc.0.22 42 9/2/2024
1.0.0-rc.0.21 54 8/27/2024
1.0.0-rc.0.20 70 8/19/2024
1.0.0-rc.0.19 67 8/13/2024
1.0.0-rc.0.18 60 7/20/2024
1.0.0-rc.0.17 52 7/20/2024
1.0.0-rc.0.16 59 7/19/2024
1.0.0-rc.0.15 51 7/17/2024
1.0.0-rc.0.13 51 7/17/2024
1.0.0-rc.0.12 51 7/17/2024
1.0.0-rc.0.11 52 7/17/2024
1.0.0-rc.0.10 56 7/16/2024
1.0.0-rc.0.9 57 7/16/2024
1.0.0-rc.0.7 55 7/16/2024
1.0.0-rc.0.5 62 7/12/2024
1.0.0-rc.0.4 50 7/12/2024
1.0.0-rc.0.3 50 7/12/2024