Pitasoft.FluentValidation
2.0.1
See the version list below for details.
dotnet add package Pitasoft.FluentValidation --version 2.0.1
NuGet\Install-Package Pitasoft.FluentValidation -Version 2.0.1
<PackageReference Include="Pitasoft.FluentValidation" Version="2.0.1" />
<PackageVersion Include="Pitasoft.FluentValidation" Version="2.0.1" />
<PackageReference Include="Pitasoft.FluentValidation" />
paket add Pitasoft.FluentValidation --version 2.0.1
#r "nuget: Pitasoft.FluentValidation, 2.0.1"
#:package Pitasoft.FluentValidation@2.0.1
#addin nuget:?package=Pitasoft.FluentValidation&version=2.0.1
#tool nuget:?package=Pitasoft.FluentValidation&version=2.0.1
Pitasoft.FluentValidation
English
FluentValidation integration for the Pitasoft.Validation ecosystem.
This package allows using validators created with FluentValidation within the Pitasoft validation system, as well as providing extension methods for direct object validation.
Installation
You can install this package via NuGet:
dotnet add package Pitasoft.FluentValidation
Features
- Transparent integration with
Pitasoft.Validation. - Register FluentValidation validators in Pitasoft's
Validator<T>. - Extension methods for direct object validation.
- Support for multiple .NET versions (net8.0, net9.0, net10.0).
Usage
Registering in a Pitasoft Validator
You can add a FluentValidation validator to a Pitasoft Validator<T> object using the RegisterFluentValidator extension method:
using Pitasoft.Validation;
using Pitasoft.FluentValidation.Extensions;
using FluentValidation;
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
public class PersonFluentValidator : AbstractValidator<Person>
{
public PersonFluentValidator()
{
RuleFor(x => x.Name).NotEmpty().WithMessage("Name is required.");
RuleFor(x => x.Age).GreaterThan(0).WithMessage("Age must be greater than 0.");
}
}
// ... in your business code ...
var validator = new Validator<Person>();
validator.RegisterFluentValidator(new PersonFluentValidator());
var person = new Person { Name = "", Age = 0 };
var result = validator.Validate(person);
if (!result.IsValid)
{
foreach (var error in result.Errors)
{
Console.WriteLine($"{error.Key}: {string.Join(", ", error.Value)}");
}
}
Direct Object Validation
You can also use extension methods directly on any object:
using Pitasoft.FluentValidation.Extensions;
var person = new Person { Name = "", Age = 0 };
var fluentValidator = new PersonFluentValidator();
// Get error collection
var errors = person.ValidateWithFluent(fluentValidator);
// Or try validate (TryParse style)
if (!person.TryValidateWithFluent(fluentValidator, out var errorCollection))
{
// Handle errors...
}
License
This project is licensed under the MIT license. See the LICENSE.txt file for more details.
Author
Sebastián Martínez Pérez - Pitasoft, S.L.
Copyright © 2020-2026 Pitasoft, S.L.
Castellano
Integración de FluentValidation para el ecosistema de validación de Pitasoft.Validation.
Este paquete permite utilizar validadores creados con FluentValidation dentro del sistema de validación de Pitasoft, así como proporcionar métodos de extensión para validar objetos de forma directa.
Instalación
Puedes instalar este paquete a través de NuGet:
dotnet add package Pitasoft.FluentValidation
Características
- Integración transparente con
Pitasoft.Validation. - Registro de validadores de FluentValidation en el
Validator<T>de Pitasoft. - Métodos de extensión para validación directa de objetos.
- Soporte para múltiples versiones de .NET (net8.0, net9.0, net10.0).
Uso
Registro en un Validador de Pitasoft
Puedes añadir un validador de FluentValidation a un objeto Validator<T> de Pitasoft utilizando el método de extensión RegisterFluentValidator:
using Pitasoft.Validation;
using Pitasoft.FluentValidation.Extensions;
using FluentValidation;
public class Persona
{
public string Nombre { get; set; }
public int Edad { get; set; }
}
public class PersonaFluentValidator : AbstractValidator<Persona>
{
public PersonaFluentValidator()
{
RuleFor(x => x.Nombre).NotEmpty().WithMessage("El nombre es obligatorio.");
RuleFor(x => x.Edad).GreaterThan(0).WithMessage("La edad debe ser mayor que 0.");
}
}
// ... en tu código de negocio ...
var validator = new Validator<Persona>();
validator.RegisterFluentValidator(new PersonaFluentValidator());
var persona = new Persona { Nombre = "", Edad = 0 };
var result = validator.Validate(persona);
if (!result.IsValid)
{
foreach (var error in result.Errors)
{
Console.WriteLine($"{error.Key}: {string.Join(", ", error.Value)}");
}
}
Validación Directa de Objetos
También puedes usar métodos de extensión directamente sobre cualquier objeto:
using Pitasoft.FluentValidation.Extensions;
var persona = new Persona { Nombre = "", Edad = 0 };
var fluentValidator = new PersonaFluentValidator();
// Obtener colección de errores
var errors = persona.ValidateWithFluent(fluentValidator);
// O intentar validar (estilo TryParse)
if (!persona.TryValidateWithFluent(fluentValidator, out var errorCollection))
{
// Manejar errores...
}
---
### Autor
Sebastián Martínez Pérez
### License
Copyright © 2026 Pitasoft, S.L.
Licensed under the [LICENSE.txt](LICENSE.txt) provided in this repository.
| 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 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
- FluentValidation (>= 12.1.1)
- Pitasoft.Validation (>= 5.1.3)
-
net8.0
- FluentValidation (>= 12.1.1)
- Pitasoft.Validation (>= 5.1.3)
-
net9.0
- FluentValidation (>= 12.1.1)
- Pitasoft.Validation (>= 5.1.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Pitasoft.FluentValidation:
| Package | Downloads |
|---|---|
|
Pitasoft.FluentValidation.AspNetCore
ASP.NET Core integration for FluentValidation. Provides Minimal API endpoint filters and MVC action filters to validate request parameters using FluentValidation.IValidator<T> and returns Pitasoft.Result validation responses. |
GitHub repositories
This package is not used by any popular GitHub repositories.