FlowR 10.0.1

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

FlowR

NuGet NuGet Version

About FlowR

FlowR is an open-source continuation of the MediatR library, which will become commercial starting with version 13. This fork aims to maintain the simplicity and power of the original while ensuring it remains freely available to the community.

FlowR is an elegant and powerful mediator implementation for .NET with a focus on workflow automation. Unlike other frameworks, FlowR relies on clear communication patterns and seamlessly supports both simple and complex use cases.

The library enables:

  • Clean separation of request and processing (CQRS pattern)
  • Implementation of complex workflows through chained requests
  • Easy extensibility through pipeline behaviors
  • Support for synchronous and asynchronous code
  • Full compatibility with legacy MediatR projects

Installation

FlowR can be easily installed via NuGet:

Install-Package FlowR

Or via the .NET Core command line:

dotnet add package FlowR

Using Only the Contracts

To use only the contract classes and interfaces (useful when you only need definitions in a separate assembly):

Install-Package FlowR.Contracts

This includes:

  • IRequest (including generic variants)
  • INotification
  • IStreamRequest

Registration with IServiceCollection

FlowR supports direct integration with Microsoft.Extensions.DependencyInjection.Abstractions:

services.AddFlowR(cfg => cfg.RegisterServicesFromAssemblyContaining<Startup>());

Or with an assembly:

services.AddFlowR(cfg => cfg.RegisterServicesFromAssembly(typeof(Startup).Assembly));

Core Concepts

Requests

Requests are objects that represent a requirement and expect a response:

public record GetUserQuery(int UserId) : IRequest<UserDto>;

public class GetUserQueryHandler : IRequestHandler<GetUserQuery, UserDto>
{
    public async Task<UserDto> Handle(GetUserQuery request, CancellationToken cancellationToken)
    {
        // Implementation to retrieve a user
    }
}

Notifications

Notifications allow publishing events to multiple handlers:

public record UserCreatedNotification(int UserId, string Username) : INotification;

public class EmailNotificationHandler : INotificationHandler<UserCreatedNotification>
{
    public async Task Handle(UserCreatedNotification notification, CancellationToken cancellationToken)
    {
        // Send a welcome email
    }
}

Pipeline Behavior

FlowR allows inserting custom behaviors into the request pipeline:

public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
    where TRequest : IRequest<TResponse>
{
    public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
    {
        // Log before processing
        var response = await next();
        // Log after processing
        return response;
    }
}

Compatibility with MediatR

FlowR provides full compatibility with MediatR through type forwarding and interface aliases. This enables seamless migration from existing MediatR projects to FlowR.

Performance Optimization with Source Generation

FlowR now offers an option for performance optimization through source generation. This avoids costly reflection and assembly scans at runtime by generating the code for handler registration during the build process.

Using Source Generation

To activate source generation, use the UseSourceGeneration() extension method in your configuration:

services.AddFlowR(config => 
{
    config.RegisterServicesFromAssemblyContaining<Startup>()
          .UseSourceGeneration(); // Activates source generation
});

How It Works

Instead of scanning all assemblies at runtime, which is resource-intensive, the FlowR Source Generator generates a static registration class at compile time. This contains all information about handlers, notifications, and other FlowR components that can then be registered directly without reflection.

  1. During the build, the source generator analyzes your code
  2. It detects all handlers, notifications, and other FlowR components
  3. It generates a special registration class that knows about these components
  4. At runtime, this generated class is used instead of assembly scanning

Benefits of Source Generation

  • Significantly improved startup performance: No costly reflection and assembly scans at runtime
  • Early error detection: Issues with handlers are detected at compile time
  • Optimized handler registration: Direct registration of handlers without dynamic type searching
  • Reduced memory usage: Fewer temporary objects during initialization
  • Better scalability: The startup time doesn't grow with the number of handlers

When to Use Source Generation

Source generation is particularly useful for:

  • Applications with many handlers and notifications
  • Services where startup time is critical
  • Serverless functions that need to start quickly
  • Containerized applications where fast startup is important

For small applications or during development, traditional assembly scanning might be more practical since it doesn't require recompilation when new handlers are added.

License

FlowR is available under the Apache 2.0 license. See LICENSE for details. Hint: FlowR will stay free to use

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 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 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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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

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
10.0.1 196 11/15/2025
3.0.3 252 11/10/2025
3.0.2 232 11/10/2025
3.0.1 187 11/9/2025
3.0.0 181 11/9/2025
1.0.2 177 11/9/2025