OpenMediatR.Abstractions 0.0.4-alpha

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

OpenMediatR

OpenMediatR is a lightweight, open-source alternative to the popular MediatR library. It provides simple in-process messaging with support for IRequest/IRequestHandler and INotification/INotificationHandler patterns, aiming for clarity, minimalism, and zero external dependencies.

⚠️ Preview Version: This is version 0.0.2, an early preview release intended for testing and feedback. APIs and structure may change.

OpenMediatR


🧩 Why "OpenMediatR"?

Because messaging should be simple, open, and yours to control — without magic, and without cost.


✨ Features

  • ✅ Clean, minimal abstraction layer
  • ✅ Zero external dependencies
  • ✅ Simple integration with .NET DI
  • ✅ Clear separation of contracts and implementation
  • ✅ Unit-test friendly architecture
  • ✅ Familiar IRequest, IRequestHandler, and ISender patterns

🧠 How It Works

Requests

// Define a request
public class Ping : IRequest<string> { }

// Implement a handler
public class PingHandler : IRequestHandler<Ping, string>
{
    public Task<string> Handle(Ping request, CancellationToken cancellationToken)
        => Task.FromResult("Pong");
}

Notifications

// Define a notification
public class Alert : INotification
{
    public string Message { get; set; }
}

// Implement a handler
public class AlertHandler : INotificationHandler<Alert>
{
    public Task Handle(Alert notification, CancellationToken cancellationToken)
    {
        Console.WriteLine(notification.Message);
        return Task.CompletedTask;
    }
}

Dispatching

public class SomeService
{
    private readonly ISender _sender;
    private readonly IPublisher _publisher;

    public SomeService(ISender sender, IPublisher publisher)
    {
        _sender = sender;
        _publisher = publisher;
    }

    public async Task Run()
    {
        var response = await _sender.Send(new Ping());
        Console.WriteLine(response); // "Pong"

        await _publisher.Publish(new Alert { Message = "Something happened!" });
    }
}

📌 Roadmap

  • Notification support (INotification)
  • Pipeline behaviors (IPipelineBehaviuor<,>)
  • Request validators (IRequestValidator<>)
  • Custom behaviors and decorators
  • NuGet packaging and CI/CD
  • Performance benchmarks

🤝 Contributing

OpenMediatR is in its infancy — contributions, ideas, and issues are all welcome! Feel free to fork, raise issues, or suggest enhancements.


📄 License

This project is licensed under the Apache License 2.0.

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 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 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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OpenMediatR.Abstractions:

Package Downloads
OpenMediatR

A FREE alternative to MediatR library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.4-alpha 208 7/19/2025
0.0.3-alpha 383 7/19/2025 0.0.3-alpha is deprecated because it has critical bugs.
0.0.2-alpha 42 7/18/2025
0.0.1-alpha 47 7/18/2025