Moongazing.OrionGuard.MediatR 6.1.0

Suggested Alternatives

OrionGuard.MediatR

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

Moongazing.OrionGuard.MediatR

MediatR integration for OrionGuard — runs your OrionGuard validators automatically inside the MediatR pipeline before each request handler.

What this package adds

  • ValidationBehavior<TRequest, TResponse> — a MediatR pipeline behavior that locates any IValidator<TRequest> registered in DI and executes it before the handler.
  • AddOrionGuardMediatR(...) — a service-collection extension that registers the behavior and scans the supplied assemblies for validators.
  • CQRS-friendly — zero reflection overhead after the first request thanks to MediatR's own DI resolution.

Install

dotnet add package Moongazing.OrionGuard.MediatR

Requires MediatR in your application; the core OrionGuard package is brought in transitively.

Quick start

using Moongazing.OrionGuard.MediatR;

builder.Services.AddOrionGuardMediatR(typeof(Program).Assembly);

// Any IValidator<TRequest> is executed automatically before its handler:
public sealed class CreateUserValidator : AbstractValidator<CreateUserCommand>
{
    public CreateUserValidator()
    {
        RuleFor(x => x.Email, "Email", p => p.NotEmpty().Email());
        RuleFor(x => x.Password, "Password", p => p.NotEmpty().MinLength(8));
    }
}

When validation fails, the pipeline short-circuits with a ValidationException carrying the full GuardResult — you can convert it to ProblemDetails with the companion Moongazing.OrionGuard.AspNetCore package.

Targets

.NET 8.0, .NET 9.0, .NET 10.0.

License

MIT. See the main repository for full docs, CHANGELOG, and samples.

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 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. 
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
6.1.0 143 4/19/2026 6.1.0 is deprecated because it is no longer maintained and has critical bugs.