BrazilModels 1.1.7
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BrazilModels --version 1.1.7
NuGet\Install-Package BrazilModels -Version 1.1.7
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="BrazilModels" Version="1.1.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BrazilModels --version 1.1.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BrazilModels, 1.1.7"
#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.
// Install BrazilModels as a Cake Addin #addin nuget:?package=BrazilModels&version=1.1.7 // Install BrazilModels as a Cake Tool #tool nuget:?package=BrazilModels&version=1.1.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BrazilModels
This library contains Models, Formatters and Validator for common Brazilian documents
Getting started
NuGet package available:
$ dotnet add package BrazilModels
Validation and Formatting
Cpf
using BrazilModels;
Cpf.Validate("00123456797"); // True
Cpf.Validate("99912345606"); // True
Cpf.Validate("999.123.456-06"); // True
Cpf.Validate("00000000000"); // False
Cpf.Validate("invalid"); // False
Cpf.Format("99912345606", withMask: true); // "999.123.456-06"
Cpf.Format("319.818.120-83", withMask: true); // "319.818.120-83"
Cpf.Format("1234567890", withMask: true); // "012.345.678-90"
Cpf.Format("12345601", withMask: true); // "000.123.456-01"
Cpf.Format("319.818.120-83"); // "31981812083"
Cpf.Format("085.974.710-77"); // "08597471077"
Cpf.Format("08597471077"); // "08597471077"
Cpf.Format("12345601"); // "00012345601"
Cnpj
using BrazilModels;
Cnpj.Validate("49.020.406/0001-25");// True
Cnpj.Validate("49020406000125"); // True
Cnpj.Validate("invalid"); // False
Cnpj.Format("49020406000125", withMask: true); // "49.020.406/0001-25"
Cnpj.Format("49.020.406/0001-25", withMask: true); // "49.020.406/0001-25"
Cnpj.Format("1123456000101", withMask: true); // "01.123.456/0001-01"
Cnpj.Format("49020406000125"); // "49020406000125"
Cnpj.Format("49.020.406/0001-25"); // "49020406000125"
Cnpj.Format("01.123.456/0001-01"); // "1123456000101"
TaxId (can be CPF or CNPJ)
using BrazilModels;
TaxId.Validate("49.020.406/0001-25");// True
TaxId.Validate("49020406000125"); // True
TaxId.Validate("99912345606"); // True
TaxId.Validate("999.123.456-06"); // True
TaxId.Format("49020406000125", withMask: true); // "49.020.406/0001-25"
TaxId.Format("99912345606", withMask: true); // "999.123.456-06"
TaxId.Format("085.974.710-77"); // "08597471077"
TaxId.Format("49.020.406/0001-25"); // "49020406000125"
Models
You can use the value types Cpf
, Cnpj
and TaxId
to strongly type your domain:
var cpf = new Cpf("319.818.120-83");
var cnpj = new Cnpj("49.020.406/0001-25");
class Person {
public Guid Id {get;init;}
public Cpf Cpf {get;init;}
}
class Company {
public Guid Id {get;init;}
public Cnpj Cnpj {get;init;}
}
They are:
- System.Text.Json compatible
- Swagger Annotations compatible
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Swashbuckle.AspNetCore.Annotations (>= 6.4.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BrazilModels:
Package | Downloads |
---|---|
BrazilModels.Swagger
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.0 | 300 | 4/3/2024 |
1.1.13 | 574 | 1/26/2024 |
1.1.12 | 1,583 | 5/24/2023 |
1.1.11 | 604 | 5/24/2023 |
1.1.10 | 1,697 | 2/10/2023 |
1.1.9 | 936 | 1/24/2023 |
1.1.8 | 2,683 | 1/16/2023 |
1.1.7 | 837 | 12/28/2022 |
1.1.6 | 740 | 12/28/2022 |
1.1.5 | 813 | 12/20/2022 |
1.1.4 | 934 | 11/27/2022 |
1.1.3 | 1,017 | 11/10/2022 |
1.1.2 | 803 | 11/8/2022 |
1.1.1 | 800 | 11/8/2022 |
1.1.0 | 781 | 11/7/2022 |
1.0.6 | 772 | 11/7/2022 |
1.0.5 | 768 | 11/7/2022 |
1.0.4 | 775 | 11/7/2022 |
1.0.3 | 794 | 11/7/2022 |
1.0.1 | 811 | 11/7/2022 |
1.0.0 | 818 | 11/7/2022 |