Verbara.Sdk.Data.Npgsql 2.2.1

dotnet add package Verbara.Sdk.Data.Npgsql --version 2.2.1
                    
NuGet\Install-Package Verbara.Sdk.Data.Npgsql -Version 2.2.1
                    
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="Verbara.Sdk.Data.Npgsql" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Verbara.Sdk.Data.Npgsql" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Verbara.Sdk.Data.Npgsql" />
                    
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 Verbara.Sdk.Data.Npgsql --version 2.2.1
                    
#r "nuget: Verbara.Sdk.Data.Npgsql, 2.2.1"
                    
#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 Verbara.Sdk.Data.Npgsql@2.2.1
                    
#: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=Verbara.Sdk.Data.Npgsql&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Verbara.Sdk.Data.Npgsql&version=2.2.1
                    
Install as a Cake Tool

Verbara.Sdk.Data.Npgsql

AOT-clean micro-layer over raw Npgsql ADO.NET. Provides reflection-free, name-based NpgsqlDataReader extension getters and an NpgsqlExecutor facade that centralizes connection open/dispose, command creation, parameter binding, and reader iteration. Replaces Dapper for Native AOT publishing — no reflection, no DynamicMethod, no source generators required.

Install

dotnet add package Verbara.Sdk.Data.Npgsql

Usage

// Name-based reader getters (reflection-free)
var name = reader.GetString("name");
var count = reader.GetInt32OrNull("count"); // returns null for DBNull

// NpgsqlExecutor facade — query list
var items = await dataSource.QueryListAsync(
    "SELECT id, name FROM items WHERE tenant = @Tenant",
    p => p.Add(new NpgsqlParameter("Tenant", tenantId)),
    r => new Item(r.GetInt32("id"), r.GetString("name")),
    cancellationToken);

// Execute non-query
await dataSource.ExecuteAsync(
    "DELETE FROM items WHERE id = @Id",
    p => p.Add(new NpgsqlParameter("Id", id)),
    cancellationToken);

// Scalar — T must match the exact CLR type Npgsql boxes for that column.
// Postgres COUNT(*)/int8 boxes a long, so use <long> (not <int>) or InvalidCastException is thrown.
var count = await dataSource.ExecuteScalarAsync<long>(
    "SELECT COUNT(*) FROM items",
    static _ => { },
    cancellationToken);

// With explicit connection + transaction
await connection.ExecuteAsync(sql, p => { ... }, transaction, cancellationToken);
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 (2)

Showing the top 2 NuGet packages that depend on Verbara.Sdk.Data.Npgsql:

Package Downloads
Verbara.Sdk.Sessions.Postgres

Verbara.Sdk.Sessions.Postgres - Postgres-backed SessionStoreBase for multi-instance deployments. Ships PostgresSessionStore + fluent UsePostgres(...) registration for Verbara.Sdk.Sessions. AOT-safe (source-generated JSON only, raw Npgsql parameterized SQL).

Verbara.Sdk.Cluster.Postgres

Verbara.Sdk.Cluster.Postgres - Postgres-backed IDistributedLock implementation for cluster-wide mutual exclusion. AOT-safe (raw Npgsql via Verbara.Sdk.Data.Npgsql facade, no reflection). Ships idempotent migration for the cluster_distributed_lock table.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.1 209 5/23/2026
2.2.0 115 5/20/2026