PouryaKit.Persistence 0.1.0-preview.2

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

PouryaKit.Persistence

NuGet .NET 10 License: MIT

PouryaKit.Persistence

The contracts Feature code reaches its data through. A handler loads and adds aggregates with IRepository<TAggregate, TId> and returns, and the Unit of Work, which a write model package supplies, keeps everything the Operation changed together or discards it together. UnitOfWorkErrors names what a commit can answer, and IUnitOfWorkConnection lets a command write a Module-internal table in plain SQL inside that same Unit of Work.

Install

dotnet add package PouryaKit.Persistence --prerelease

When to use it

  • You are reading and changing an aggregate through the repository and a specification.
  • A command writes a projection, a tally or a copy that no aggregate maps.
  • You handle a concurrent change as an Error.

A Module references PouryaKit.Persistence.Postgres, which brings this package and PouryaKit.Persistence.EFCore. PouryaKit.Persistence.Marten is the other write model, and PouryaKit.Persistence.Dapper serves reads for display.

Quick start

There is nothing to register here: the Module's write model fills these contracts. Inject the repository, change the aggregate and return its Result, as the Proving Sample does:

internal sealed class RenameProductCommandHandler(IRepository<Product, ProductId> products)
    : CommandHandler<RenameProductCommand>
{
    public override async Task<Result> Handle(
        RenameProductCommand command,
        CancellationToken cancellationToken
    )
    {
        var product = await products.FindAsync(new ProductId(command.ProductId), cancellationToken);
        return product is null ? ProductErrors.NotFound : product.Rename(command.Name);
    }
}

What you get

  • A generic repository with specifications, and nothing on it saves.
  • UnitOfWorkErrors, so a commit that cannot go through is an Error, not an exception.
  • A plain-SQL write that commits or rolls back with the Operation, through IUnitOfWorkConnection.

Nothing in a Module saves or commits. Feature code never calls SaveChanges and never opens a transaction, and a structure test rejects a Module that does.

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

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

Package Downloads
PouryaKit.Persistence.EFCore

The EF Core Unit of Work: a DbContext per Module that saves and commits each Operation once, with the repository, audit, soft delete and conflicts as Errors.

PouryaKit.Persistence.Marten

Streams on Marten over PostgreSQL: aggregates stored as the events they appended, loaded by folding them, with a Unit of Work of their own.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.2 108 11/1/2026
0.1.0-preview.1 113 10/31/2026
0.1.0-preview.0.28 111 10/26/2026