Brazilian.PrimitivesTypes 1.2.2

dotnet add package Brazilian.PrimitivesTypes --version 1.2.2
                    
NuGet\Install-Package Brazilian.PrimitivesTypes -Version 1.2.2
                    
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="Brazilian.PrimitivesTypes" Version="1.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Brazilian.PrimitivesTypes" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Brazilian.PrimitivesTypes" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Brazilian.PrimitivesTypes --version 1.2.2
                    
#r "nuget: Brazilian.PrimitivesTypes, 1.2.2"
                    
#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.
#:package Brazilian.PrimitivesTypes@1.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Brazilian.PrimitivesTypes&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Brazilian.PrimitivesTypes&version=1.2.2
                    
Install as a Cake Tool

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

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
1.2.2 115 8/28/2026
1.2.1 103 8/27/2026
1.2.0 110 8/25/2026
1.1.2 103 8/24/2026
1.1.1 104 8/24/2026