PouryaKit.Persistence.Postgres 0.1.0-preview.1

This is a prerelease version of PouryaKit.Persistence.Postgres.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package PouryaKit.Persistence.Postgres --version 0.1.0-preview.1
                    
NuGet\Install-Package PouryaKit.Persistence.Postgres -Version 0.1.0-preview.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="PouryaKit.Persistence.Postgres" Version="0.1.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PouryaKit.Persistence.Postgres" Version="0.1.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="PouryaKit.Persistence.Postgres" />
                    
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 PouryaKit.Persistence.Postgres --version 0.1.0-preview.1
                    
#r "nuget: PouryaKit.Persistence.Postgres, 0.1.0-preview.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 PouryaKit.Persistence.Postgres@0.1.0-preview.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=PouryaKit.Persistence.Postgres&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PouryaKit.Persistence.Postgres&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Tool

PouryaKit.Persistence.Postgres

NuGet .NET 10 License: MIT

PouryaKit.Persistence.Postgres

Each Module's EF Core data in its own PostgreSQL schema. UsePouryaKitPostgres gives a Module its DbContext on Npgsql, keeps its migrations history in that schema and makes the DbContext the Module's Unit of Work. Modules may share one connection string, and each keeps its own schema.

Install

dotnet add package PouryaKit.Persistence.Postgres --prerelease

When to use it

  • You give a Module its database and schema: this is the package a Module references to store its aggregates.
  • A unique value should come back as the Error of your choice.
  • A number must be gap-free, such as one sequence of invoice numbers per year.
  • You are adding a migration.

It brings PouryaKit.Persistence and PouryaKit.Persistence.EFCore. Add PouryaKit.Persistence.Dapper for reads in SQL and PouryaKit.Messaging.Wolverine.EFCore for deliveries.

Quick start

Declare the Module's store in its Composition Root, as the Proving Sample's Catalog does:

module.UsePouryaKitPostgres<CatalogDbContext>(connectionName: "app", schema: "catalog");
module.MapPouryaKitUniqueConstraint<CatalogDbContext>(
    ProductConfiguration.NameIndex,
    ProductErrors.NameInUse
);

Number sequences take a registration of their own, and a migration of the Module that calls CreateNumberSequenceTable with its schema, or the first number throws:

module.AddPouryaKitNumberSequences();

A command asks for the next number inside its Unit of Work:

var number = await sequences.NextAsync($"stock-count:{year}", cancellationToken);

What you get

  • A schema per Module, with its own migrations history, on one or several databases.
  • A violated unique index read back as the Error the Module mapped.
  • Gap-free numbers per scope key, given back when the Operation rolls back.

The Host applies no migration at startup. Apply each Module's migrations yourself; in tests, HostFixture of PouryaKit.Testing applies them.

Learn more

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 (3)

Showing the top 3 NuGet packages that depend on PouryaKit.Persistence.Postgres:

Package Downloads
PouryaKit.Testing

Test against the hosted application: PostgreSQL in a Testcontainers container, data reset between tests, Operations through a Gateway, deliveries awaited and dead letters replayed.

PouryaKit.Reporting.Module

The Kit's report Module: report jobs generated in the background, stored through the Host's file storage and served to their requester by a time-limited link.

PouryaKit.AI.Postgres

Text stored by its embedding and searched by meaning with pgvector in PostgreSQL, within the tenant, in the Operation's Unit of Work.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.2 80 11/1/2026
0.1.0-preview.1 87 10/31/2026
0.1.0-preview.0.28 80 10/26/2026