https://github.com/renanaragao/fluentvalidation-extensions
Pacote de validations Built-In para Fluentvalidation
https://github.com/renanaragao/fluentvalidation-extensions
cellphone-validator cep-validator cnpj-validator cpf-validador emails-validator fluentvalidation integer-validator ip-validator phone-validator unique-list uri-validator
Last synced: about 1 month ago
JSON representation
Pacote de validations Built-In para Fluentvalidation
- Host: GitHub
- URL: https://github.com/renanaragao/fluentvalidation-extensions
- Owner: renanaragao
- License: mit
- Created: 2021-03-05T14:44:23.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-10T14:03:44.000Z (almost 3 years ago)
- Last Synced: 2025-10-24T22:56:28.954Z (4 months ago)
- Topics: cellphone-validator, cep-validator, cnpj-validator, cpf-validador, emails-validator, fluentvalidation, integer-validator, ip-validator, phone-validator, unique-list, uri-validator
- Language: C#
- Homepage:
- Size: 52.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FluentvalidationBR.Extensions#
Built-In validation package for Fluentvalidation
### How to install with Nuget ?
```
dotnet add package FluentvalidationBR.Extensions
```
### What is this repository for? ###
This package aims to extend some built-in validations that we already have in fluent validations.
For now we have:
- CnpjValidator
- CpfValidator
- IntegerValidator
- UriValidator
- CellPhoneValidator
- PhoneValidator
- CepValidator
- IpValidator
- IsUnique
- EmailsValidator - Validate one or more separate emails with ';'
### How do I use it? ###
```.cs
class SampleValidator : AbstractValidator
{
public SampleValidator()
{
RuleFor(x => x.CellPhone).CellPhone();
RuleFor(x => x.Number).Integer();
RuleFor(x => x.Site).Uri();
RuleFor(x => x.Cpf).Cpf();
RuleFor(x => x.Cnpj).Cnpj();
RuleFor(x => x.Cep).Cep();
RuleFor(x => x.Phone).Phone();
RuleFor(x => x.Ip).Ip();
RuleFor(x => x.Items).IsUnique(x => x.Id);
RuleFor(x => x.Items).IsUnique(x => x.ItemsB, x => x.Id);
RuleFor(x => x.Codes).IsUnique();
RuleFor(x => x.Emails).Emails(); //Validate one or more separate emails with ';'
}
}
class Sample
{
public string Site { get; set; }
public string Number { get; set; }
public string Cpf { get; set; }
public string Cnpj { get; set; }
public string CellPhone { get; set; }
public string Phone { get; set; }
public string Cep { get; set; }
public string Ip { get; set; }
public string Emails { get; set; }
public IEnumerable Codes { get; set; }
public IEnumerable Items { get; set; }
public IEnumerable ItemsA { get; set; }
}
class Item
{
public int Id { get; set; }
}
```