EventStoreCore.Postgres
1.0.2-beta.2
dotnet add package EventStoreCore.Postgres --version 1.0.2-beta.2
NuGet\Install-Package EventStoreCore.Postgres -Version 1.0.2-beta.2
<PackageReference Include="EventStoreCore.Postgres" Version="1.0.2-beta.2" />
<PackageVersion Include="EventStoreCore.Postgres" Version="1.0.2-beta.2" />
<PackageReference Include="EventStoreCore.Postgres" />
paket add EventStoreCore.Postgres --version 1.0.2-beta.2
#r "nuget: EventStoreCore.Postgres, 1.0.2-beta.2"
#:package EventStoreCore.Postgres@1.0.2-beta.2
#addin nuget:?package=EventStoreCore.Postgres&version=1.0.2-beta.2&prerelease
#tool nuget:?package=EventStoreCore.Postgres&version=1.0.2-beta.2&prerelease
EventStoreCore.Postgres
PostgreSQL persistence configuration for EventStoreCore using EF Core and Npgsql.
Setup
Register your application DbContext, configure the EventStore model in
OnModelCreating, and tell EventStoreCore to reuse that context:
using EventStoreCore;
using EventStoreCore.Postgres;
using Microsoft.EntityFrameworkCore;
public sealed class AppDbContext(DbContextOptions<AppDbContext> options)
: DbContext(options)
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.UseEventStore();
}
}
services.AddDbContext<AppDbContext>(
options => options.UseNpgsql(connectionString));
services.AddEventStore(builder =>
{
builder.ExistingDbContext<AppDbContext>();
});
ExistingDbContext<TDbContext>() does not create or migrate a separate
database. EventStoreCore uses the application-owned context, connection,
transaction, and migrations. Add migrations from the application project after
calling UseEventStore().
Provider behavior
- Event payloads and snapshots use PostgreSQL
jsonbcolumns. - Stream identity is
(Id, StreamType, TenantId). - Event ordering within a stream is protected by a unique
(StreamId, StreamType, TenantId, Version)index. EventIdis a generated or caller-supplied GUID with a global uniqueness constraint; consumers must not rely on GUID ordering.- Global event-log reads use the generated
Events.Sequenceprimary key plus filtered sequence indexes for tenant, logical stream type, and logical event type. - Registered event-store and entity-outbox writers acquire a PostgreSQL transaction-scoped advisory lock before generated sequence allocation and hold it through commit. This makes sequence checkpoints gap-safe; rollbacks can leave gaps but lower sequences cannot commit late.
- Inline projections share the append transaction. Subscription and eventual projection delivery is at-least-once.
- Daemons require an application-provided
IDistributedLockProvider.
Provider-specific database migrations remain application owned. Review generated
migrations when upgrading EventStoreCore, especially changes to keys, indexes,
or required metadata columns. Existing databases need a migration that makes
Events.Sequence the generated primary key and adds the unique stream-version
index.
The commit-ordering change itself has no schema migration. Upgrade every writer
for a database together; a mixed deployment or direct SQL writer that does not
acquire the advisory lock can invalidate the checkpoint fence. Sequence-
allocating transactions serialize until commit, so keep explicit transactions
short and replay or rebuild consumers whose old checkpoints may already have
skipped an event. A direct SQL writer participates by calling
pg_advisory_xact_lock(1163281236, 1397048149) in its transaction before the
first insert into Events or OutboxMessages.
| Product | Versions 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. |
-
net10.0
- EventStoreCore (>= 1.0.2-beta.2)
- EventStoreCore.Abstractions (>= 1.0.2-beta.2)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.0)
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.2-beta.2 | 115 | 7/28/2026 |
| 1.0.2-beta.1 | 48 | 7/26/2026 |
| 1.0.1 | 416 | 5/25/2026 |
| 1.0.0-beta.13 | 201 | 4/8/2026 |
| 1.0.0-beta.12 | 617 | 2/15/2026 |
| 1.0.0-beta.11 | 66 | 2/13/2026 |
| 1.0.0-beta.10 | 76 | 2/13/2026 |
| 1.0.0-beta.9 | 132 | 2/5/2026 |
| 1.0.0-beta.8 | 79 | 2/3/2026 |
| 1.0.0-beta.7 | 68 | 2/3/2026 |
| 1.0.0-beta.6 | 72 | 2/2/2026 |
| 1.0.0-beta.5 | 79 | 1/17/2026 |
| 1.0.0-beta.4 | 74 | 1/16/2026 |
| 1.0.0-beta.3 | 80 | 1/15/2026 |
| 1.0.0-beta.2 | 72 | 1/14/2026 |
| 1.0.0-beta.1 | 80 | 1/13/2026 |