KUKULCAN.SharedKernel.Database 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package KUKULCAN.SharedKernel.Database --version 1.0.1
                    
NuGet\Install-Package KUKULCAN.SharedKernel.Database -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="KUKULCAN.SharedKernel.Database" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KUKULCAN.SharedKernel.Database" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="KUKULCAN.SharedKernel.Database" />
                    
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 KUKULCAN.SharedKernel.Database --version 1.0.1
                    
#r "nuget: KUKULCAN.SharedKernel.Database, 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 KUKULCAN.SharedKernel.Database@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=KUKULCAN.SharedKernel.Database&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=KUKULCAN.SharedKernel.Database&version=1.0.1
                    
Install as a Cake Tool

KUKULCAN.SharedKernel.Database

Overview

KUKULCAN.SharedKernel.Database is the shared persistence and Entity Framework Core infrastructure module used by KUKULCAN applications and bounded contexts. It builds on KUKULCAN.SharedKernel and centralizes database cross-cutting concerns without introducing business-domain rules into the shared domain model.

The library targets .NET 10 and EF Core 10. Provider packages are deliberately supplied by consuming applications or infrastructure projects.

Responsibilities

  • KukulcanDbContextBase for common EF Core configuration.
  • SQL Server and PostgreSQL provider selection through DatabaseProvider.
  • Strongly typed configuration through KukulcanDatabaseOptions.
  • IUnitOfWork and UnitOfWork<TContext> for persistence and explicit transactions.
  • Audit timestamp population through SharedKernel IAuditable.
  • Soft-delete conversion and filtering through SharedKernel ISoftDelete.
  • Persistence-level tenant isolation through ITenantContext and TenantId.
  • Domain-event dispatch after successful persistence.
  • Append-only enforcement through IImmutable.
  • Slow-query diagnostics through SlowQueryInterceptor.
  • Dependency-injection registration helpers.

Architectural Boundary

This project is infrastructure, not a second domain kernel. It consumes stable contracts from KUKULCAN.SharedKernel and keeps persistence-only abstractions local. It must not contain bounded-context business rules, application services, CQRS handlers or generic repositories.

KUKULCAN.SharedKernel
          ^
          |
KUKULCAN.SharedKernel.Database
          ^
          |
 consuming Infrastructure / Host applications

Project Structure

KUKULCAN.SharedKernel.Database/
├── Source/KUKULCAN.SharedKernel.Database/
│   ├── Abstractions/
│   ├── Configuration/
│   ├── Extensions/
│   ├── Interceptors/
│   ├── UnitOfWork/
│   └── KukulcanDbContextBase.cs
└── SourceClient/

Core Components

KukulcanDbContextBase

Provides common provider configuration, model-configuration discovery, global filters and persistence interceptors for derived module contexts.

Persistence Interceptors

Component Responsibility
AuditSaveChangesInterceptor Sets CreatedOn for added auditable entities and ModifiedOn for modified entities.
SoftDeleteInterceptor Converts deletes of ISoftDelete entities into logical deletes and records DeletedOn.
DomainEventDispatchInterceptor Dispatches pending domain events after a successful save and clears them.
ImmutableEntityInterceptor Rejects updates and deletes of IImmutable entities.
SlowQueryInterceptor Logs commands exceeding SlowQueryThresholdMs.

Unit of Work

IUnitOfWork exposes asynchronous saving and explicit transaction lifecycle operations. Repository abstractions are intentionally outside this package.

Tenant Isolation

ITenantContext supplies the current Guid tenant identifier. ApplyTenantFilter applies a global filter to entity types that expose a Guid TenantId property. Tenant awareness remains a persistence concern and is not added to SharedKernel merely for EF Core support.

Providers

The core package does not reference provider packages. Consumers add the provider they need, such as Microsoft.EntityFrameworkCore.SqlServer or Npgsql.EntityFrameworkCore.PostgreSQL. The current DatabaseProvider enum supports SqlServer and PostgresSql.

Configuration

Options are bound from Kukulcan:Database. Sensitive-data logging is disabled by default and should remain disabled in production.

Registration

services.AddKukulcanDbContext<MyModuleDbContext>(configuration);

The registration helper binds options, registers the context, registers IUnitOfWork and registers the slow-query interceptor.

Requirements

  • .NET 10
  • KUKULCAN.SharedKernel 1.0.0 or compatible
  • EF Core 10
  • Microsoft.Extensions Options, DI, Logging and Configuration abstractions 10
  • A database provider package supplied by the consuming project when required

Quality

Nullable reference types are enabled, warnings are treated as errors and XML documentation generation is enabled. Public APIs are documented and persistence behavior is intended to be covered by behavior-focused tests.

License

See the repository LICENSE file for the applicable GPL terms.

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 KUKULCAN.SharedKernel.Database:

Package Downloads
KUKULCAN.SharedKernel.Auth

Provides authentication and authorization components for the KUKULCAN architecture, including local authentication, federated credential validation, multi-tenant identity management, user and tenant membership handling, and authentication infrastructure. Designed to provide consistent, reusable, and secure authentication capabilities across KUKULCAN applications and services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 845 9/7/2026
1.0.1 278 8/23/2026
1.0.0 363 8/17/2026

This hotfix fixes the following:

           - In the ASP.NET Core DI container, the correct thing to do is to request ILogger<T>, not the concrete Logger<T> implementation.