PouryaKit.Persistence.EFCore
0.1.0-preview.2
dotnet add package PouryaKit.Persistence.EFCore --version 0.1.0-preview.2
NuGet\Install-Package PouryaKit.Persistence.EFCore -Version 0.1.0-preview.2
<PackageReference Include="PouryaKit.Persistence.EFCore" Version="0.1.0-preview.2" />
<PackageVersion Include="PouryaKit.Persistence.EFCore" Version="0.1.0-preview.2" />
<PackageReference Include="PouryaKit.Persistence.EFCore" />
paket add PouryaKit.Persistence.EFCore --version 0.1.0-preview.2
#r "nuget: PouryaKit.Persistence.EFCore, 0.1.0-preview.2"
#:package PouryaKit.Persistence.EFCore@0.1.0-preview.2
#addin nuget:?package=PouryaKit.Persistence.EFCore&version=0.1.0-preview.2&prerelease
#tool nuget:?package=PouryaKit.Persistence.EFCore&version=0.1.0-preview.2&prerelease

PouryaKit.Persistence.EFCore
The EF Core Unit of Work. A Module's DbContext derives from PouryaKitDbContext, and for each Operation the Unit of Work runs the Domain Event Handlers, stamps audit and soft-delete fields, writes the Outbox, saves once and commits. A concurrent change, or a duplicate value on a unique index the Module mapped, comes back as an Error.
Install
dotnet add package PouryaKit.Persistence.EFCore --prerelease
When to use it
- You are mapping an aggregate.
- Two aggregates of one Module must change together, in one commit: a Domain Event Handler.
- An aggregate needs audit fields, soft delete or a unique value.
- You read a sorted and filtered Page through the repository.
You rarely reference it alone: PouryaKit.Persistence.Postgres brings it and adds the database. PouryaKit.Messaging.Wolverine.EFCore joins its Unit of Work to the message store.
Quick start
Derive the Module's DbContext, then map only what is specific, as the Proving Sample does:
internal sealed class CatalogDbContext(DbContextOptions<CatalogDbContext> options)
: PouryaKitDbContext(options);
internal sealed class ProductConfiguration : IEntityTypeConfiguration<Product>
{
public const string NameIndex = "ix_products_name";
public void Configure(EntityTypeBuilder<Product> builder)
{
builder.ToTable("products");
builder.Property(product => product.Name).HasMaxLength(200);
builder
.HasIndex(product => new { product.Tenant, product.Name })
.IsUnique()
.HasFilter("is_deleted = false")
.HasDatabaseName(NameIndex);
}
}
What you get
- One save and one commit per Operation, in a fixed sequence, with no save in your code.
- Domain Event Handlers that join that same commit.
- Audit and soft-delete fields set by the Unit of Work, never by the domain.
- A concurrent change as a conflict Error, and a mapped unique index as the Error the Module chose.
- A Page through the repository, sorted and filtered only by what the query declared.
The repository writes only inside a Unit of Work, so an add or a remove anywhere else throws instead of being silently lost.
Learn more
| 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
- Ardalis.Specification.EntityFrameworkCore (>= 9.3.1)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- PouryaKit.Core (>= 0.1.0-preview.2)
- PouryaKit.Cqrs (>= 0.1.0-preview.2)
- PouryaKit.Persistence (>= 0.1.0-preview.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on PouryaKit.Persistence.EFCore:
| Package | Downloads |
|---|---|
|
PouryaKit.Persistence.Postgres
Each Module's EF Core data in its own PostgreSQL schema on Npgsql, with unique-value Errors and gap-free number sequences. |
|
|
PouryaKit.Messaging.Wolverine.EFCore
Every EF Core Module's Outbox and Receipts on Wolverine: what a Module publishes is written in the commit of its change, in PostgreSQL. |
|
|
PouryaKit.Realtime
Server-sent events pushed from Notification Handlers, carried between a Host's instances by PostgreSQL notifications, only within the delivery's tenant. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.2 | 92 | 11/1/2026 |
| 0.1.0-preview.1 | 106 | 10/31/2026 |
| 0.1.0-preview.0.28 | 97 | 10/26/2026 |