Arcturus.Mediation
2025.7.22.136
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Arcturus.Mediation --version 2025.7.22.136
NuGet\Install-Package Arcturus.Mediation -Version 2025.7.22.136
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="Arcturus.Mediation" Version="2025.7.22.136" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Arcturus.Mediation" Version="2025.7.22.136" />
<PackageReference Include="Arcturus.Mediation" />
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 Arcturus.Mediation --version 2025.7.22.136
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Arcturus.Mediation, 2025.7.22.136"
#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 Arcturus.Mediation@2025.7.22.136
#: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=Arcturus.Mediation&version=2025.7.22.136
#tool nuget:?package=Arcturus.Mediation&version=2025.7.22.136
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Arcturus.Mediation
This package provides a complete implementation of the Arcturus Mediation framework, enabling CQRS (Command Query Responsibility Segregation) patterns with middleware support and event publishing.
Features
- Request/Response Pattern: Send commands and queries with type-safe responses
- Middleware Pipeline: Add cross-cutting concerns like logging, validation, and authorization
- Event Publishing: Publish notifications to multiple handlers
- Dependency Injection: Built-in support for Microsoft.Extensions.DependencyInjection
Quick Start
1. Register Services
services.AddMediation(configuration =>
{
configuration.RegisterHandlersFromAssembly(typeof(Program).Assembly);
configuration.AddMiddleware<LoggingMiddleware>();
configuration.AddMiddleware<ValidationMiddleware>();
});
2. Define Requests and Handlers
// Query with response
public record GetUserQuery(int UserId) : IRequest<User>;
public class GetUserHandler : IRequestHandler<GetUserQuery, User>
{
public async Task<User> Handle(GetUserQuery request, CancellationToken cancellationToken)
{
// Implementation
return user;
}
}
// Command without response
public record DeleteUserCommand(int UserId) : IRequest;
public class DeleteUserHandler : IRequestHandler<DeleteUserCommand>
{
public async Task Handle(DeleteUserCommand request, CancellationToken cancellationToken)
{
// Implementation
}
}
3. Define Notifications and Handlers
public record UserDeletedNotification(int UserId) : INotification;
public class EmailNotificationHandler : INotificationHandler<UserDeletedNotification>
{
public async Task Handle(UserDeletedNotification notification, CancellationToken cancellationToken)
{
// Send email notification
}
}
public class AuditLogHandler : INotificationHandler<UserDeletedNotification>
{
public async Task Handle(UserDeletedNotification notification, CancellationToken cancellationToken)
{
// Log to audit system
}
}
4. Use the Mediator
public class UserController : ControllerBase
{
private readonly IMediator _mediator;
public UserController(IMediator mediator)
{
_mediator = mediator;
}
[HttpGet("{id}")]
public async Task<User> GetUser(int id)
{
return await _mediator.Send(new GetUserQuery(id));
}
[HttpDelete("{id}")]
public async Task DeleteUser(int id)
{
await _mediator.Send(new DeleteUserCommand(id));
await _mediator.Publish(new UserDeletedNotification(id));
}
}
Middleware
Create custom middleware to add cross-cutting concerns:
public class LoggingMiddleware : IMiddleware
{
private readonly ILogger<LoggingMiddleware> _logger;
public LoggingMiddleware(ILogger<LoggingMiddleware> logger)
{
_logger = logger;
}
public async Task InvokeAsync(IMiddlewareContext context, RequestDelegate next)
{
_logger.LogInformation("Handling request {RequestType}", context.RequestType.Name);
var stopwatch = Stopwatch.StartNew();
await next();
stopwatch.Stop();
_logger.LogInformation("Handled request {RequestType} in {ElapsedMs}ms",
context.RequestType.Name, stopwatch.ElapsedMilliseconds);
}
}
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 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 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
- Arcturus.Mediation.Abstracts (>= 2025.7.22.136)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
-
net9.0
- Arcturus.Mediation.Abstracts (>= 2025.7.22.136)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Arcturus.Mediation:
Package | Downloads |
---|---|
Arcturus.Mediation.Sample
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2025.9.17.187 | 50 | 9/17/2025 |
2025.9.12.180 | 94 | 9/12/2025 |
2025.9.11.175 | 132 | 9/11/2025 |
2025.9.1.173 | 171 | 9/1/2025 |
2025.8.14.168 | 185 | 8/14/2025 |
2025.8.13.166 | 137 | 8/13/2025 |
2025.8.12.164 | 140 | 8/12/2025 |
2025.8.11.156 | 131 | 8/11/2025 |
2025.8.11.154 | 127 | 8/11/2025 |
2025.8.4.149 | 149 | 8/4/2025 |
2025.7.25.141 | 373 | 7/25/2025 |
2025.7.22.138 | 523 | 7/22/2025 |
2025.7.22.136 | 525 | 7/22/2025 |