Cayaqui.MPS.Abstractions.Validation 0.1.0

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

Cayaqui.MPS.Abstractions.Validation

FluentValidation cross-cutting decorator for the MPS CQRS IHandler pipeline.

Contenido

Tipo Descripción
ValidationHandlerDecorator<TIn, TResult> Decorator que envuelve IHandler<TIn, Result<TResult>> con un IValidator<TIn> opcional. Si no hay validador → delega directo. Si valida y falla → devuelve DomainError.Validation con errores por campo en Metadata — sin lanzar excepciones.

Distribución propietaria — requiere contrato comercial con Cayaqui. Ver LICENSE.txt.

Por qué un paquete separado

Cayaqui.MPS.Abstractions es zero-dependency por diseño. Cayaqui.MPS.Abstractions.Validation lleva FluentValidation como dependencia explícita, de modo que los consumidores que no necesiten validación en el pipeline no la arrastran.

Instalación

dotnet add package Cayaqui.MPS.Abstractions.Validation

Uso típico

// Validator (FluentValidation)
public sealed class CreateUserValidator : AbstractValidator<CreateUserCommand>
{
    public CreateUserValidator()
    {
        RuleFor(x => x.Name).NotEmpty().MaximumLength(200);
        RuleFor(x => x.Email).NotEmpty().EmailAddress();
    }
}

// Decorar el handler
IHandler<CreateUserCommand, Result<Guid>> pipeline =
    new ValidationHandlerDecorator<CreateUserCommand, Guid>(
        inner: new CreateUserCommandHandler(db),
        validator: new CreateUserValidator());

var result = await pipeline.Handle(cmd, ct);

if (result.IsFailure)
{
    // result.Error.Value.Type == ErrorType.Validation
    // result.Error.Value.Metadata["Name"] == ["'Name' must not be empty."]
}

Con DI + Scrutor

services.AddScoped<IValidator<CreateUserCommand>, CreateUserValidator>();
services.Decorate<IHandler<CreateUserCommand, Result<Guid>>,
                  ValidationHandlerDecorator<CreateUserCommand, Guid>>();

Requisitos

  • .NET 10.0 o superior
  • Cayaqui.MPS.Abstractions >= 0.1.0
  • FluentValidation >= 12.0
Product Compatible and additional computed target framework versions.
.NET 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 (1)

Showing the top 1 NuGet packages that depend on Cayaqui.MPS.Abstractions.Validation:

Package Downloads
Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore

EF Core integration for Cayaqui.MPS.BuildingBlocks: transactional Outbox (EfOutboxStore with Postgres FOR UPDATE SKIP LOCKED + redispatch/purge hosted services + multi-store health check), audit + domain-event-dispatch SaveChanges interceptors, and Blazor Server-safe scoped CQRS handlers (ScopedQueryHandler/ScopedCommandHandler over IDbContextFactory returning Result<T>). Proprietary — requires a commercial agreement with Cayaqui.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 119 6/4/2026

Initial release. ValidationHandlerDecorator — wraps IHandler with optional FluentValidation, returns DomainError.Validation with per-field Metadata on failure.