Purview.Containers.PostgreSql 1.0.0-prerelease.10

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

Purview.Containers.PostgreSql

Throwaway PostgreSQL databases for .NET integration testing on WSL Containers (WSLC) or Docker.

dotnet add package Purview.Containers.PostgreSql

Backend-neutral: depends on Purview.Containers.Core and needs a backend package (Purview.Containers.Wsl or Purview.Containers.Docker) and brings Npgsql for connection-string generation. See the Getting Started guide.

Requirements

  • WSL Containers backend: Windows 10/11 with WSL Containers (wsl --install --no-distribution), and a .NET 10 or later project. A platform-neutral net10.0 project binds the portable facade and gets automatic WSLC-or-Docker selection; a Windows target framework (net10.0-windows10.0.19041.0, x64 or arm64) binds the implementation directly. The Purview.Containers.Wsl package supplies buildTransitive defaults for WindowsSdkPackageVersion/PlatformTarget and (for a platform-neutral consumer on a Windows build host) the implementation payload, rejecting an unsupported consumer with PCC0001/PCC0002 — see the consumer requirements.
  • Docker backend: any reachable Docker daemon (docker info), with a net10.0 or later project on any platform. No Windows target framework and no PCC guards apply.
  • Experimental: the API, defaults and packaging can change between prereleases; there is no production support guarantee.

Quick start

using Npgsql;
using Purview.Containers.PostgreSql;

await using var postgres = new PostgreSqlBuilder()
    .WithDatabase("tests")
    .WithUsername("postgres")
    .WithPassword("postgres")
    .Build();

await postgres.StartAsync();   // waits for pg_isready

await using var connection = new NpgsqlConnection(postgres.GetConnectionString());
await connection.OpenAsync();

API

Member Purpose
PostgreSqlBuilder() / PostgreSqlBuilder(string image) Default image postgres:17, or a custom image.
PostgreSqlBuilder.PostgreSqlPort (5432) Container port, mapped to a random host port.
WithDatabase(string) Sets POSTGRES_DB (default postgres).
WithUsername(string) Sets POSTGRES_USER (default postgres).
WithPassword(string) Sets POSTGRES_PASSWORD (default postgres); stored as a redacted Secret.
PostgreSqlContainer.GetConnectionString() NpgsqlConnectionStringBuilder connection string for the mapped host port.

Build() rejects an empty database, username or password with ContainerConfigurationException. The default wait strategy runs pg_isready -U {username} -d {database} inside the container unless you supply your own with WithWaitStrategy(...). Call GetConnectionString() after StartAsync().

Documentation

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.0.0-prerelease.10 39 10/29/2026
1.0.0-prerelease.9 50 10/27/2026
1.0.0-prerelease.8 105 10/22/2026
1.0.0-prerelease.7 64 10/16/2026
1.0.0-prerelease.6 69 10/6/2026
1.0.0-prerelease.5 65 10/2/2026
1.0.0-prerelease.4 62 10/2/2026
1.0.0-prerelease.3 59 10/2/2026
1.0.0-prerelease.2 57 10/1/2026