Slipstream 0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Slipstream --version 0.0.2
                    
NuGet\Install-Package Slipstream -Version 0.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="Slipstream" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Slipstream" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Slipstream" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Slipstream --version 0.0.2
                    
#r "nuget: Slipstream, 0.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.
#:package Slipstream@0.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Slipstream&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Slipstream&version=0.0.2
                    
Install as a Cake Tool

Slipstream

Fast, lean CQRS dispatcher with pipeline behaviors.

Slipstream is a lightweight alternative to MediatR focused on doing one thing well — dispatching requests through a pipeline to a single handler. No event publishing, no bloat, just clean request/response dispatching.


Features

  • Request/response dispatching via IDispatcher
  • Void request support (fire-and-forget style)
  • Pipeline behaviors for cross-cutting concerns (logging, validation, transactions, etc.)
  • Reflection-free hot path via cached generic wrappers
  • No dependencies beyond Microsoft.Extensions.DependencyInjection.Abstractions

Installation

dotnet add package Slipstream

Quick Start

1. Define a request

// With a response
public record GetOrderById(int Id) : IRequest<Order>;

// Without a response
public record DeleteOrder(int Id) : IRequest;

2. Implement a handler

public class GetOrderByIdHandler : IRequestHandler<GetOrderById, Order>
{
    public Task<Order> Handle(GetOrderById request, CancellationToken cancellationToken)
    {
        // your logic here
        return Task.FromResult(new Order(request.Id));
    }
}

public class DeleteOrderHandler : IRequestHandler<DeleteOrder>
{
    public Task Handle(DeleteOrder request, CancellationToken cancellationToken)
    {
        // your logic here
        return Task.CompletedTask;
    }
}

3. Register with your DI container

// Register the dispatcher
services.AddTransient<IDispatcher, SlipstreamDispatcher>();

// Register handlers manually...
services.AddTransient<IRequestHandler<GetOrderById, Order>, GetOrderByIdHandler>();

// ...or use assembly scanning
services.RegisterHandlersAndBehaviors(typeof(GetOrderByIdHandler).Assembly);

4. Dispatch

public class OrdersController
{
    private readonly IDispatcher _dispatcher;

    public OrdersController(IDispatcher dispatcher)
    {
        _dispatcher = dispatcher;
    }

    public async Task<Order> Get(int id)
    {
        return await _dispatcher.Send(new GetOrderById(id));
    }
}

Pipeline Behaviors

Behaviors wrap handler execution and are ideal for logging, validation, exception handling, and transactions.

public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
    where TRequest : IRequest<TResponse>
{
    private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger;

    public LoggingBehavior(ILogger<LoggingBehavior<TRequest, TResponse>> logger)
    {
        _logger = logger;
    }

    public async Task<TResponse> Handle(
        TRequest request,
        CancellationToken cancellationToken,
        RequestHandlerDelegate<TResponse> next)
    {
        _logger.LogInformation("Handling {Request}", typeof(TRequest).Name);
        var response = await next();
        _logger.LogInformation("Handled {Request}", typeof(TRequest).Name);
        return response;
    }
}

Register behaviors with your DI container:

services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));

Behaviors execute in registration order, wrapping the handler like an onion:

Behavior1 -> Behavior2 -> Handler -> Behavior2 -> Behavior1

Assembly Scanning

Slipstream includes a registration helper to scan assemblies and register all handlers and behaviors automatically:

// Using the IRegistrar abstraction (container-agnostic)
var registrar = new DelegateRegistrar(
    (service, impl) => services.AddTransient(service, impl),
    (service, impl) => services.AddTransient(service, impl)
);

registrar.RegisterHandlersAndBehaviors(typeof(MyHandler).Assembly);

Why Not MediatR?

MediatR is excellent but carries features many projects don't need — notifications, polymorphic dispatch, and a growing surface area. Slipstream is for teams that want the request/pipeline pattern without the overhead.

Slipstream MediatR
Request/Response ✅ ✅
Pipeline Behaviors ✅ ✅
Notifications ❌ intentional ✅
Reflection-free hot path ✅ ✅ (v12+)
Dependencies Abstractions only Abstractions only

License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
0.0.5 141 4/8/2026
0.0.4 118 3/23/2026
0.0.3 110 3/20/2026
0.0.2 104 3/20/2026
0.0.1 109 3/20/2026