CultureBR.DataTypes.Extensions.FluentValidation
1.0.0
dotnet add package CultureBR.DataTypes.Extensions.FluentValidation --version 1.0.0
NuGet\Install-Package CultureBR.DataTypes.Extensions.FluentValidation -Version 1.0.0
<PackageReference Include="CultureBR.DataTypes.Extensions.FluentValidation" Version="1.0.0" />
paket add CultureBR.DataTypes.Extensions.FluentValidation --version 1.0.0
#r "nuget: CultureBR.DataTypes.Extensions.FluentValidation, 1.0.0"
// Install CultureBR.DataTypes.Extensions.FluentValidation as a Cake Addin #addin nuget:?package=CultureBR.DataTypes.Extensions.FluentValidation&version=1.0.0 // Install CultureBR.DataTypes.Extensions.FluentValidation as a Cake Tool #tool nuget:?package=CultureBR.DataTypes.Extensions.FluentValidation&version=1.0.0
<a href="https://github.com/FernandoDona/culturebr-datatypes"></a>
<div align="center">
Contém extensões para projetos de validação como o FluentValidation
<a href="https://www.nuget.org/packages/CultureBR.DataTypes"><img alt="Nuget" src="https://img.shields.io/nuget/v/CultureBR.DataTypes.Extensions.FluentValidation"></a> <br/>
dotnet add package CultureBR.DataTypes.Extensions.FluentValidation
</div>
O que é
É uma biblioteca que oferece extensões para bibliotecas de validação como o FluentValidation utilizando o projeto <a href="https://github.com/FernandoDona/culturebr-datatypes">CultureBR.DataTypes</a> para realizar as validações.
Como funciona
As validações são feitas verificando se o input segue as regras de determinado tipo de dado.
Por padrão a validação é feita sem aceitar espaços em branco ou caracteres especiais fora da formatação correta. Isso é feito utilizando o parâmetro Validation.Hard
.
Para a validação ser mais permissiva que permita caracteres em branco e caracteres especiais fora de ordem desde que a regra do tipo de dado seja respeitada é só utilizar o parâmetro Validation.Soft
.
Caso opte por usar Validation.Soft
é possível utilizar os formatadores da biblioteca <a href="https://github.com/FernandoDona/culturebr-datatypes">CultureBR.DataTypes</a> para realizar a formatação correta.
Fluent Validation
Para extender a o FluentValidation e validar dados como CPF, CNPJ e CEP é bem simples. Exemplo:
public PersonCPFValidator()
{
RuleFor(person => person.CPFString).ValidateCPF();
}
public PersonCNPJValidator()
{
RuleFor(person => person.CNPJString).ValidateCNPJ();
}
public PersonCEPValidator()
{
RuleFor(person => person.CEPString).ValidateCEP();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- CultureBR.DataTypes (>= 1.0.1)
- FluentValidation (>= 11.5.1)
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 | 336 | 3/4/2023 |