Purview.EventSourcing.Postgres 2.0.0-prerelease.31

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

Purview.EventSourcing.Postgres

Purview.EventSourcing.Postgres provides PostgreSQL event-stream persistence and an optional PostgreSQL queryable snapshot store for Purview EventSourcing.

Install

dotnet add package Purview.EventSourcing.Postgres

Register the providers

builder.Services.AddPostgresEventStore();
builder.Services.AddPostgresSnapshotQueryableEventStore();
{
  "ConnectionStrings": {
    "eventstore-postgres": "Host=localhost;Database=MyApp;Username=postgres;Password=postgres"
  }
}

What it provides

  • Event-stream persistence for aggregates loaded through IEventStore
  • Optional query/list/count snapshot-backed reads through IQueryableEventStore
  • Internal event-store snapshots to support replay optimization strategies in append-only streams
  • SQL-specific transaction factory (IPostgresEventStoreTransactionFactory) for enlisting additional SQL/EF work in the same commit (all enlisted stores must share the same SQL transaction boundary)
  • Separate PostgreSQL configuration binding for event and snapshot stores
  • Entity Framework-backed schema creation and CRUD paths
  • JSONB-backed event and snapshot payload storage
  • Shared-table safety: when aggregate types share a table, event-stream reads and deletes are scoped by both aggregate id and aggregate type
  • Tolerant replay for long-lived streams: integration-tested handling for unknown event types and schema-evolved/unappliable historical events

JSONB payloads and querying

The snapshot payload is the fully serialized aggregate graph stored in a single JSONB column. EF queries run against that JSON payload, so aggregate properties remain transparent to callers.

Use regular LINQ for strongly-typed queries:

await store.QueryAsync(a => a.ComplexTestType != null && a.ComplexTestType.Int32Property == 42);

Use explicit JSONB operator helpers when you want GIN-friendly containment/existence checks:

await store.WherePayloadContainsAsync("""{"ComplexTestType":{"StringProperty":"active"}}""", new() { MaxRecords = 50 });
await store.WherePayloadHasKeyAsync("ComplexTestType", new() { MaxRecords = 50 });

WherePayloadContainsAsync maps to PostgreSQL @> and WherePayloadHasKeyAsync maps to ?.

Event store snapshots vs query snapshots

  • The event store remains append-only and is the source of truth.
  • Internal snapshots inside the event store are used only to optimize replay based on snapshot strategy.
  • Those internal snapshots are not a substitute for the query store and are not intended for ad-hoc querying.
  • The queryable snapshot store is optional.
  • If you do need a dedicated query/read store, it can be PostgreSQL via AddPostgresSnapshotQueryableEventStore(), or a different read technology in your application architecture.

Declaring JSON path indexes

Configure GIN and expression indexes via options:

options.JsonIndexOptions = new PostgresJsonIndexOptions
{
    Enabled = true,
    UseJsonbPathOps = true,
    PathIndexes =
    [
        new() { Path = "ComplexTestType.StringProperty", IndexName = "ix_snapshots_status" }
    ]
};

Supported members are writable primitives, [Scalar] value objects, complex objects composed of supported members, and EventStoreList<T> / EventStoreSet<T> collections of supported primitive or complex members.

Important query distinction:

  • A [Scalar] value object with a primitive inner value is generally query-friendly.
  • A [Scalar] value object with a complex inner value is persisted correctly, but deep predicates through .Value are not guaranteed to translate in SQL snapshot queries.
  • If deep SQL predicates are required for a complex concept, expose the underlying complex type directly on the aggregate/query snapshot model (for example, a ParserReportSummary mirror property) and verify the exact nested predicate with integration tests.

Unsupported shapes fail during model creation, including arrays and collection types other than EventStoreList<T> / EventStoreSet<T> (for example List<T>, IReadOnlyList<T>, IEnumerable<T>, HashSet<T>, ImmutableArray<T>), except where a provider-specific JSON conversion path is explicitly supported and tested. Read-only and [JsonIgnore] members are excluded from the JSON payload.

Documentation

  • Repository README
  • Provider feature matrix
    • Includes behavior notes/caveats (IsDeletedAsync missing behavior, tolerant replay, principal requirements)
    • Includes snapshot payload/query-translation guidance for scalar value objects vs directly mapped complex mirrors
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 (1)

Showing the top 1 NuGet packages that depend on Purview.EventSourcing.Postgres:

Package Downloads
Purview.EventSourcing.Admin.Postgres

Postgres query adapters for Purview EventSourcing Admin Portal.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0-prerelease.31 41 9/12/2026
2.0.0-prerelease.30 56 9/8/2026
2.0.0-prerelease.29 74 8/3/2026