NKF.Persistence.Postgres.Base 1.0.1

Requires NuGet 5.0.0 or higher.

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

NKF.Persistence.Postgres.Base

EF Core PostgreSQL implementation for NKF Persistence.

Features

  • CommandRepository<T> — EF Core write repository base (auto-assigns ITenantAware.TenantId)
  • QueryRepository<T> — EF Core read repository base (auto-assigns ITenantAware.TenantId)
  • TypedCommandRepository<TEntity,TId> — EF Core typed write repository base (1.0.1)
  • TypedQueryRepository<TEntity,TId> — EF Core typed read repository base (1.0.1)
  • CommandUnitOfWork — Transaction management with MediatR for domain events + TenantId propagation
  • QueryUnitOfWork — Read-only unit of work + TenantId propagation
  • Tenant Services — Multi-tenancy with connection resolution
  • FAppDbContext — Base DbContext with tenant support

Install

dotnet add package NKF.Persistence.Postgres.Base

Usage

public class BrandCommandRepository : CommandRepository<Brand>, IBrandCommandRepository
{
    public BrandCommandRepository(AppDbContext context) : base(context) { }
    
    public Task<bool> HasExistBrandByName(BrandName name, CancellationToken ct)
        => Context.Set<Brand>().AnyAsync(b => b.DefaultName == name, ct);
}

// Typed (1.0.1)
public class TypedBrandCommandRepository : TypedCommandRepository<TypedBrand, BrandId>, ITypedBrandCommandRepository
{
    public TypedBrandCommandRepository(AppDbContext context) : base(context) { }
    public Task<bool> HasExistBrandByName(BrandName name, CancellationToken ct)
        => Context.Set<TypedBrand>().AnyAsync(b => b.DefaultName == name, ct);
}

// DI Registration (TenantId propagated automatically)
services.AddScoped<ICommandUnitOfWork, CommandUnitOfWork>(s =>
    new CommandUnitOfWork(
        s.GetRequiredService<AppDbContext>(),
        CommandCollection.DeepCopy(),
        s.GetRequiredService<IMediator>()
    ));
// Typed repos share the same CommandCollection / QueryCollection via AddFromAssembly

Repository

github.com/rasoolnikravesh/NKF

License

Apache-2.0

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

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.1 98 8/29/2026
1.0.1-beta.1.1 75 8/17/2026
1.0.0 105 8/16/2026

See CHANGELOG.md