An extension of the fluent validation with a set of Brazilian validations
🇧🇷 Switch to portuguese version
The prupose of this library is create a extension with brazilian´s validation to FluentValidation package.
This library was designed to provide a set of brazilian´s attributes validation such as CPF, CNPJ
Install with Package Manager
Nuget
PM > Install-Package Extensions.FluentValidation.Br
Install with .NET CLI
.NET CLI
dotnet add package Extensions.FluentValidation.Br
public class Person
{
public string Name { get; set; }
public string CPF { get; set; }
public string CNPJ { get; set; }
}
public class PersonValidator : AbstractValidator<Person>
{
public PersonValidator ()
{
RuleFor(employee => employee.Name).NotNull();
RuleFor(employee => employee.CPF).IsValidCPF();
RuleFor(employee => employee.CNPJ).IsValidCNPJ();
}
}
dotnet test
Contributions via pull requests are welcome :-).
MIT © Lucas Mendes Loureiro