OpenMediatR 0.0.4-alpha
dotnet add package OpenMediatR --version 0.0.4-alpha
NuGet\Install-Package OpenMediatR -Version 0.0.4-alpha
<PackageReference Include="OpenMediatR" Version="0.0.4-alpha" />
<PackageVersion Include="OpenMediatR" Version="0.0.4-alpha" />
<PackageReference Include="OpenMediatR" />
paket add OpenMediatR --version 0.0.4-alpha
#r "nuget: OpenMediatR, 0.0.4-alpha"
#:package OpenMediatR@0.0.4-alpha
#addin nuget:?package=OpenMediatR&version=0.0.4-alpha&prerelease
#tool nuget:?package=OpenMediatR&version=0.0.4-alpha&prerelease
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.
🧩 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
, andISender
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 | Versions 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- OpenMediatR.Abstractions (>= 0.0.4-alpha)
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.4-alpha | 211 | 7/19/2025 | |
0.0.3-alpha | 390 | 7/19/2025 | |
0.0.2-alpha | 46 | 7/18/2025 | |
0.0.1-alpha | 47 | 7/18/2025 |