Mecesoft.Mediator
1.0.0
dotnet add package Mecesoft.Mediator --version 1.0.0
NuGet\Install-Package Mecesoft.Mediator -Version 1.0.0
<PackageReference Include="Mecesoft.Mediator" Version="1.0.0" />
<PackageVersion Include="Mecesoft.Mediator" Version="1.0.0" />
<PackageReference Include="Mecesoft.Mediator" />
paket add Mecesoft.Mediator --version 1.0.0
#r "nuget: Mecesoft.Mediator, 1.0.0"
#:package Mecesoft.Mediator@1.0.0
#addin nuget:?package=Mecesoft.Mediator&version=1.0.0
#tool nuget:?package=Mecesoft.Mediator&version=1.0.0
Mecesoft.Mediator
Package version: 1.0.0 (not yet published on NuGet)
Supports .NET 8 and .NET 10. Includes optimized request dispatch, improved pipeline execution, and configurable notification publishing.
Mecesoft.Mediator is a lightweight, dependency-injection-friendly mediator library for .NET. It supports requests, notifications, dependency-injection scopes, and ordered pipeline behaviors without an external mediator dependency.
Project links
- GitHub repository
- NuGet package (draft; version 1.0.0 is not published yet):
https://www.nuget.org/packages/Mecesoft.Mediator
Installation
Version 1.0.0 is not published yet. The intended installation command after publication is:
dotnet add package Mecesoft.Mediator
Registration
Register handlers from one or more assemblies and, optionally, open pipeline behaviors:
using Mecesoft.Mediator;
builder.Services.AddMediator(options =>
{
options.AddRegisterAssemblies(typeof(Program).Assembly);
options.AddOpenBehavior(typeof(LoggingBehavior<,>));
});
ISender and discovered handlers are registered as transient services. Resolve
ISender from the request scope so handlers can safely consume scoped services
such as DbContext.
Requests
Requests with a response implement IRequest<TResponse>:
public sealed record GetUser(Guid Id) : IRequest<User>;
public sealed class GetUserHandler(IUserRepository repository)
: IRequestHandler<GetUser, User>
{
public Task<User> Handle(
GetUser request,
CancellationToken cancellationToken) =>
repository.GetAsync(request.Id, cancellationToken);
}
User user = await sender.Send(new GetUser(id), cancellationToken);
Void requests implement IRequest and use IRequestHandler<TRequest>.
Cancellation tokens are passed to handlers and pipeline behaviors unchanged.
Pipeline behaviors
For response requests, a pipeline behavior declares both the request and response types:
public sealed class LoggingBehavior<TRequest, TResponse>
: IPipelineBehavior<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
public async Task<TResponse> Handle(
TRequest request,
RequestHandlerDelegate<TResponse> next,
CancellationToken cancellationToken = default)
{
return await next();
}
}
Void requests use IPipelineBehavior<TRequest> and RequestHandlerDelegate.
Pipeline behaviors execute in registration order and may short-circuit without
constructing the request handler.
Notifications
Notification handlers run concurrently by default. Applications whose handlers share scoped dependencies that are not concurrency-safe can opt into sequential execution during registration:
builder.Services.AddMediator(options =>
{
options.AddRegisterAssemblies(typeof(Program).Assembly);
options.PublishNotificationsConcurrently = false;
});
Notification and request handler failures propagate to the caller without being wrapped in reflection exceptions.
API
The 1.0.0 public API uses:
IRequest, IRequest<TResponse>, IRequestHandler, ISender, Sender,
INotification, INotificationHandler, IPipelineBehavior, AddMediator,
MediatorOptions, RequestHandlerDelegate, and
MediatorOptions.PublishNotificationsConcurrently.
No legacy aliases are provided. Consumer code must use AddMediator,
MediatorOptions, and RequestHandlerDelegate.
License
Mecesoft.Mediator is available under the MIT License.
| 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 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. |
-
net10.0
-
net8.0
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 |
|---|---|---|
| 1.0.0 | 110 | 10/23/2026 |
Initial release under the Mecesoft.Mediator identity.
Public API: AddMediator, MediatorOptions, and RequestHandlerDelegate.
Supports .NET 8 and .NET 10.