Brazilian.PrimitivesTypes
1.2.2
dotnet add package Brazilian.PrimitivesTypes --version 1.2.2
NuGet\Install-Package Brazilian.PrimitivesTypes -Version 1.2.2
<PackageReference Include="Brazilian.PrimitivesTypes" Version="1.2.2" />
<PackageVersion Include="Brazilian.PrimitivesTypes" Version="1.2.2" />
<PackageReference Include="Brazilian.PrimitivesTypes" />
paket add Brazilian.PrimitivesTypes --version 1.2.2
#r "nuget: Brazilian.PrimitivesTypes, 1.2.2"
#:package Brazilian.PrimitivesTypes@1.2.2
#addin nuget:?package=Brazilian.PrimitivesTypes&version=1.2.2
#tool nuget:?package=Brazilian.PrimitivesTypes&version=1.2.2
Brazilian.PrimitivesTypes
Strongly typed, immutable .NET value objects for Brazilian identifiers and domain data.
Use this package when you want Brazilian primitives such as CPF, CNPJ, CEP, Pix keys, phone numbers, vehicle identifiers, RG, state registrations, and banking identifiers without coupling your domain model to a persistence framework.
Install
dotnet add package Brazilian.PrimitivesTypes
The current package targets .NET 10.
Quick start
using Brazilian.PrimitivesTypes;
Cpf cpf = Cpf.Parse("529.982.247-25");
Cnpj cnpj = Cnpj.Parse("00.000.000/e08g-12");
Cep cep = Cep.Parse("01311-000");
ChavePix pix = ChavePix.Parse("(11) 98765-4321");
Console.WriteLine(cpf.Value); // 52998224725
Console.WriteLine(cnpj.Value); // 00000000E08G12
Console.WriteLine(cep.Formatted); // 01311-000
Console.WriteLine(pix.Value); // +5511987654321
What this package provides
- Strongly typed domain values instead of loose strings.
- Deterministic parsing and normalization.
- Preservation of meaningful leading zeros.
- Local check-digit validation where the identifier defines one.
- Explicit formatting APIs.
- Immutable value-object semantics.
- No dependency on EF Core, Dapper, SQL Server, or external services.
Supported primitives
| Domain | Types |
|---|---|
| Personal and company tax registrations | Cpf, Cnpj, CpfCnpj |
| Address and contact data | Cep, Email, LandlinePhone, MobilePhone, TelefoneBrasileiro |
| Pix and banking | ChavePix, Ispb, CodigoCompe |
| Civil, labor, health, and electoral identifiers | Rg, Cnh, Cns, Nit, PisPasep, TituloEleitoral |
| State tax and vehicle registrations | InscricaoEstadual, PlacaVeiculo, Renavam |
See the complete primitive inventory for accepted formats, canonical values, normalization, and validation behavior.
Validation boundaries
IsValid, TryParse, and Parse are local operations. They do not query Receita Federal, Correios, Banco Central, DICT, Anatel, SENATRAN, DETRAN, TSE, CADSUS, SINTEGRA, SEFAZ, or other official registries.
A value accepted by the library may be structurally or mathematically valid while still not existing, not being active, or not belonging to a specific person or organization.
Persistence integrations
Persistence support is intentionally distributed as separate packages:
| Package | Use when |
|---|---|
Brazilian.PrimitivesTypes.EntityFrameworkCore.SqlServer |
Your persistence layer uses Entity Framework Core with SQL Server |
Brazilian.PrimitivesTypes.Dapper.SqlServer |
Your persistence layer uses Dapper with SQL Server |
Keeping these integrations separate allows the domain package to remain persistence-agnostic.
Documentation
Related packages
| Package | Purpose |
|---|---|
Brazilian.PrimitivesTypes |
Core Brazilian value objects |
Brazilian.PrimitivesTypes.EntityFrameworkCore.SqlServer |
EF Core + SQL Server integration |
Brazilian.PrimitivesTypes.Dapper.SqlServer |
Dapper + SQL Server integration |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Brazilian.PrimitivesTypes:
| Package | Downloads |
|---|---|
|
Brazilian.PrimitivesTypes.EntityFrameworkCore.SqlServer
Entity Framework Core SQL Server integration for Brazilian.PrimitivesTypes. Provides conventions and value converters for persisting Brazilian value objects with provider-aware varchar mappings, including state-aware RG and InscricaoEstadual mappings. |
|
|
Brazilian.PrimitivesTypes.Dapper.SqlServer
Dapper SQL Server integration for Brazilian.PrimitivesTypes. Provides TypeHandler registrations that persist canonical Brazilian value-object values with explicit ANSI varchar metadata and materialize supported primitives directly from queries. |
GitHub repositories
This package is not used by any popular GitHub repositories.