Pinqponq.Database.Postgres.EntityFrameworkCore 1.0.0

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

Pinqponq.Database.Postgres.EntityFrameworkCore

Registers an EF Core DbContext on PostgreSQL (Npgsql) in one call, with one shared NpgsqlDataSource (connection pool) per context and a hook to configure that data source. Entities, configurations and migrations stay in the application.

Services that use Npgsql without EF Core take Pinqponq.Database.Postgres instead; this package keeps the EF Core dependency out of them.

Install

dotnet add package Pinqponq.Database.Postgres.EntityFrameworkCore

Quick start

using Pinqponq.Database.Postgres.EntityFrameworkCore.DependencyInjection;

builder.Services.AddPinqponqPostgresDbContext<AppDbContext>(
    builder.Configuration.GetConnectionString("PostgreSql"),
    dataSource => dataSource.EnableDynamicJson(
        jsonbClrTypes: [typeof(Dictionary<string, string>)],
        jsonClrTypes: []));
Parameter Notes
connectionString Required. A missing or blank value throws InvalidOperationException at registration, so the service fails at startup.
configureDataSource Optional Action<NpgsqlDataSourceBuilder>: type mappings, dynamic JSON, logging.
configureNpgsql Optional Action<NpgsqlDbContextOptionsBuilder>: migrations assembly, retry on failure, …

Behavior

  • The data source is built once, on first use, and registered as the singleton PostgresDbContextDataSource<TDbContext>; the container disposes it on shutdown. Each context type has its own, so two contexts with different connection strings or data source settings do not share a pool.
  • The context itself is registered with AddDbContext (scoped), as EF Core does by default.

Dependencies

Npgsql.EntityFrameworkCore.PostgreSQL 8.0.10 or later (Microsoft.EntityFrameworkCore 8.0.31, Npgsql 8.0.5). An application on EF Core 9 or 10 references its own provider version and resolves to it.

Repository

https://github.com/pinqponq/pinqnuqets

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.0.0 567 10/17/2026