RequestFlow.Abstractions 1.0.0-preview.9

Prefix Reserved
This is a prerelease version of RequestFlow.Abstractions.
dotnet add package RequestFlow.Abstractions --version 1.0.0-preview.9
                    
NuGet\Install-Package RequestFlow.Abstractions -Version 1.0.0-preview.9
                    
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="RequestFlow.Abstractions" Version="1.0.0-preview.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RequestFlow.Abstractions" Version="1.0.0-preview.9" />
                    
Directory.Packages.props
<PackageReference Include="RequestFlow.Abstractions" />
                    
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 RequestFlow.Abstractions --version 1.0.0-preview.9
                    
#r "nuget: RequestFlow.Abstractions, 1.0.0-preview.9"
                    
#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 RequestFlow.Abstractions@1.0.0-preview.9
                    
#: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=RequestFlow.Abstractions&version=1.0.0-preview.9&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RequestFlow.Abstractions&version=1.0.0-preview.9&prerelease
                    
Install as a Cake Tool

RequestFlow

This is a request/handler mediator for .NET. Built-in validation checks mediator and application-defined rules at startup. Frozen maps route requests through prebuilt execution plans.

Supports Task and ValueTask requests, stages, streams, and events. Additionally, RequestFlow.Cqrs adds a type-enforced command/query split. Registration runs at startup without a source generator, analyzer, or other build step.

NuGet Downloads CI License: MIT Status Targets

Status: preview on NuGet. Install with the --prerelease flag:

dotnet add package RequestFlow --prerelease

See the preview.9 release notes for additions and API renames.

Getting started: define a request, register its handler, and send it.

Startup validation

AddRequestFlow collects registrations. ValidateRequestFlow() closes the stage chains and runs every built-in and application-defined rule. If all validations pass, it freezes the valid model. Otherwise, it reports all problems in a single RequestFlowValidationException.

builder.Services
    .AddRequestFlow(options =>
    {
        options.RegisterHandlersFromCallingAssembly();
        options.AddStage(
            typeof(ValidationStage<,>),
            stage => stage.WhereHandlerImplements<IOrdersCommandHandler>());
    })
    .AddValidationRule<CommandValidationStageRule>();

WebApplication app = builder.Build();
app.Services.ValidateRequestFlow();

In the modular sample, CommandValidationStageRule reads the frozen stage chain and rejects commands without ValidationStage<,>. The convention is checked at startup instead of during code review.

A custom rule can inspect request and response contracts, selected handlers, closed stages, stream shapes, events, and event strategies. It reports into the same exception as the built-in checks. See Validation rules.

Why RequestFlow

  • Startup validation reports missing and duplicate handlers, invalid stage closures, event problems, CQRS conflicts, and application-defined rule failures in one exception.
  • Task request, ValueTask request, stream, and event plans freeze once. Dispatch starts with a map lookup and uses no reflection, LINQ, or locking.
  • Repeated AddRequestFlow calls are additive, so each module can register its assembly into the same application model.
  • Task requests, ValueTask requests, streams, and events use separate dispatch surfaces. The optional CQRS package adds Task and ValueTask command/query dispatchers plus stream-query dispatch.

Modular monoliths

The sample keeps module registration beside module code:

builder.Services.AddOrdersModule().AddCqrs();
builder.Services.AddAuditModule();

AddOrdersModule() and AddAuditModule() each call AddRequestFlow for their own assembly and add to the same registry. An OrderPlaced event from Orders can reach an Audit handler, and startup validation covers both modules.

See the sample walkthrough.

Modern .NET first

RequestFlow targets .NET 10 and .NET 8 directly. It also ships netstandard2.0 and net462 assets for applications that still run on older targets.

Runtime registration uses assembly discovery and dynamic generic construction during freeze, so RequestFlow does not support trimming or NativeAOT. See Compatibility.

Coming from MediatR

Most request and handler changes are mechanical. Event semantics and some extension points differ.

MediatR RequestFlow
IRequest<TResponse>, IRequest same names in the RequestFlow namespace
IRequestHandler<TRequest, TResponse>.Handle IRequestHandler<TRequest, TResponse>.HandleAsync
ISender.Send or IMediator.Send IRequestDispatcher.SendAsync
IPipelineBehavior<,> IRequestStage<,>
IStreamRequest<T> and CreateStream IStreamRequest<T> and IStreamDispatcher.Stream
INotification and Publish IEvent and IEventPublisher.PublishAsync
services.AddMediatR(...) services.AddRequestFlow(...)

Void handlers return plain Task; Unit does not appear in user code. Existing Task and Task<T> handlers keep those return types.

The MediatR migration guide covers the file-by-file sequence, event differences, conditional registration, and unsupported extension points.

Packages

  • RequestFlow.Abstractions holds Task and ValueTask requests, handlers, dispatchers, stages, streaming, events, publish strategies, validation models, and exceptions. It has no package dependency on net8.0 or net10.0.
  • RequestFlow adds Task and ValueTask dispatch, event publication, assembly and manual registration, startup validation, and frozen execution plans.
  • RequestFlow.Cqrs.Abstractions holds Task and ValueTask command/query contracts, stream-query contracts, handlers, and typed dispatchers.
  • RequestFlow.Cqrs adds the Task and ValueTask command/query dispatchers, stream-query dispatcher, and AddCqrs() validation rule on top of the core runtime.

Install a runtime package at the composition root. Reference an abstractions package directly from a domain or application layer that should not depend on runtime registration.

Documentation

  • Getting started: install, first request and handler, dispatching
  • ValueTask requests: measured opt-in requests, stages, CQRS, and consumption rules
  • Registration: scanning, manual registration, generic handlers, additive calls, startup validation
  • Stages: wrapping handlers, execution order, filters, and request selection
  • Pipeline inspection: declared handlers, ordered stages, and stage exclusion reasons
  • Streaming: stream requests, stream stages, cancellation, and enumeration timing
  • Events: polymorphic delivery, strategies, ordering, failures, and cancellation
  • Validation rules: application-defined checks over the frozen registration model
  • Compatibility: modern targets, downlevel targets, trimming, and NativeAOT
  • Migrating from MediatR: concept mapping and semantic differences
  • Service lifetimes: handler, stage, dispatcher, and publisher lifetimes
  • Exceptions: exceptions, timing, and fixes
  • Modular sample: an API host with independently registered Orders and Audit modules

Contributing

Design feedback is the most useful contribution while the packages are in preview.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 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 was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on RequestFlow.Abstractions:

Package Downloads
RequestFlow.Cqrs.Abstractions

CQRS contracts for RequestFlow Task and ValueTask commands and queries, stream queries, handlers, and typed dispatchers. Reference this from domain and application layers without taking the runtime.

RequestFlow

Request/handler mediator for .NET with Task and ValueTask dispatch, startup validation, application-defined validation rules, stages, streaming, events, and frozen dispatch plans. MIT, with no compiler plugin or generated dispatch code.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.9 80 9/8/2026
1.0.0-preview.8 85 8/23/2026
1.0.0-preview.7 82 8/15/2026
1.0.0-preview.6 79 8/9/2026
1.0.0-preview.5 111 8/7/2026
1.0.0-preview.4 94 8/2/2026
1.0.0-preview.3 88 8/1/2026
1.0.0-preview.2 90 8/1/2026
1.0.0-preview.1 86 7/12/2026