Brazilian.PrimitivesTypes.Dapper.SqlServer 1.2.2

dotnet add package Brazilian.PrimitivesTypes.Dapper.SqlServer --version 1.2.2
                    
NuGet\Install-Package Brazilian.PrimitivesTypes.Dapper.SqlServer -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.Dapper.SqlServer" 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.Dapper.SqlServer" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Brazilian.PrimitivesTypes.Dapper.SqlServer" />
                    
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.Dapper.SqlServer --version 1.2.2
                    
#r "nuget: Brazilian.PrimitivesTypes.Dapper.SqlServer, 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.Dapper.SqlServer@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.Dapper.SqlServer&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Brazilian.PrimitivesTypes.Dapper.SqlServer&version=1.2.2
                    
Install as a Cake Tool

Brazilian.PrimitivesTypes.Dapper.SqlServer

Dapper + SQL Server integration for Brazilian.PrimitivesTypes.

Use this package when you want Brazilian primitive value objects to participate directly in Dapper parameters and query materialization while keeping the core domain package independent from Dapper.

Install

dotnet add package Brazilian.PrimitivesTypes.Dapper.SqlServer

The package references Brazilian.PrimitivesTypes and Dapper.

To open SQL Server connections, your application also needs an ADO.NET provider such as Microsoft.Data.SqlClient.

Register the handlers

Register the type handlers once during application bootstrap, before the first Dapper operation:

using Brazilian.PrimitivesTypes.Dapper.SqlServer;

BrazilianPrimitivesDapperSqlServer.Register();

Registration is safe to call repeatedly, but registering once during startup is the recommended pattern.

Use primitives directly

After registration, supported primitives can be sent directly as scalar parameters:

using Brazilian.PrimitivesTypes;
using Dapper;

Cpf cpf = Cpf.Parse("529.982.247-25");

CustomerRow? customer = await connection.QuerySingleOrDefaultAsync<CustomerRow>(
    """
    SELECT Id, Cpf, Email, Cep
    FROM dbo.Customers
    WHERE Cpf = @Cpf;
    """,
    new { Cpf = cpf });

The handlers persist canonical values using ANSI string metadata and the recommended SQL Server varchar(n) size.

They also materialize supported primitives directly from query results.

Schema remains your responsibility

Dapper does not provide a model builder or migrations. This package does not create tables, columns, indexes, or constraints.

For example:

CREATE TABLE dbo.Customers
(
    Id BIGINT NOT NULL,
    Cpf VARCHAR(11) NOT NULL,
    Email VARCHAR(254) NULL,
    Cep VARCHAR(8) NOT NULL,
    CONSTRAINT PK_Customers PRIMARY KEY (Id)
);

Nullable values

Use nullable primitives (T?) and null to represent SQL NULL. A default struct value is not a valid absence sentinel.

RG and State Registration

For Rg and InscricaoEstadual, this integration is value-only: the handler persists the canonical value but does not persist Brazilian state context.

If state context must be preserved, store it explicitly in your schema or use the EF Core state-aware integration.

List expansion

Dapper 2.1.x list expansion (IN @Values) does not invoke the registered handler for each element. Collections of Brazilian primitives are therefore not declared as a supported handler scenario.

When list expansion is required, deliberately project the collection to canonical values before passing it to Dapper.

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.2 95 8/28/2026
1.2.1 89 8/27/2026
1.2.0 95 8/25/2026