Geaux.SharedKernal 1.2.0

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

Geaux.SharedKernal

Foundational domain-driven building blocks for GeauxPlatform and modern .NET applications. Provides CQRS primitives, domain events, entity base classes, value objects, repository abstractions, audit trail, and soft delete support.

Geaux.SharedKernal provides the essential abstractions and base classes needed to implement Domain-Driven Design (DDD), CQRS, and clean architectural separation across your application. It is intentionally minimal, framework-agnostic, and highly reusable.

This library contains no Entity Framework, no ASP.NET Core hosting code, and no platform-specific dependencies β€” making it ideal for use in domain layers, use case layers, and NuGet packages.


✨ Features

  • 🧱 Entity base classes with domain event support
  • 🎯 ValueObject infrastructure with equality & comparison semantics
  • πŸ”” Domain events & dispatching abstractions
  • πŸ”„ Mediator pipeline behaviors, including logging
  • πŸ“¬ CQRS primitives (ICommand, IQuery, and handler interfaces)
  • πŸ“š Repository abstractions (IRepository, IReadRepository) compatible with Specification pattern
  • πŸ•’ Auditable trail (IAuditable) for created/modified timestamps
  • πŸ—‘οΈ Soft delete (ISoftDelete) for logical deletion support
  • 🎨 100% framework‑agnostic, usable in any architecture (Clean, Onion, Hexagonal)

πŸ“¦ Installation

dotnet add package Geaux.SharedKernal

🧱 Core Building Blocks

Entities

  • EntityBase (int identifier)
  • EntityBase<TId> (strongly‑typed identifier)
  • EntityBase<T, TId> (pattern‑friendly base for typed IDs)
  • IAggregateRoot (marker interface for aggregate roots)
  • IAuditable (created/modified timestamps for audit trail)
  • ISoftDelete (flag for logical deletion)

EntityBase

A base class for aggregate roots or domain entities.

Features:

  • Automatic tracking of domain events
  • Generic (EntityBase<TId>) and non-generic versions
  • Equality based on identifier
  • Hook for clearing/processing domain events

Example

public class Order : EntityBase<Guid>, IAggregateRoot
{
    public DateTime CreatedOn { get; private set; } = DateTime.UtcNow;
}

ValueObject

Implements the classic DDD Value Object pattern using component-based equality.

Features:

  • Automatic equality comparisons
  • Sorting support via IComparable
  • Semantic equality instead of object identity

Example

public class Money : ValueObject
{
    public decimal Amount { get; }
    public string Currency { get; }

    public Money(decimal amount, string currency)
    {
        Amount = amount;
        Currency = currency;
    }

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return Amount;
        yield return Currency;
    }
}

πŸ”” Domain Events

Domain events allow aggregates to publish meaningful system changes.


DomainEventBase

public abstract class DomainEventBase : INotification
{
    public DateTime DateOccurred { get; } = DateTime.UtcNow;
}

Each event is attached to an entity and later dispatched.


IDomainEventDispatcher

Abstraction that hands domain events off to an external mechanism (such as MediatR).


MediatRDomainEventDispatcher

A concrete implementation using MediatR:

  • Dispatches events after persistence completes
  • Ensures reliable event handling patterns

🧭 CQRS Abstractions

Geaux.SharedKernal defines command/query primitives compatible with MediatR.

Commands

public interface ICommand<TResult> : IRequest<TResult> { }
public interface ICommandHandler<TCommand, TResult> 
    : IRequestHandler<TCommand, TResult> where TCommand : ICommand<TResult>;

Queries

public interface IQuery<TResult> : IRequest<TResult> { }
public interface IQueryHandler<TQuery, TResult>
    : IRequestHandler<TQuery, TResult> where TQuery : IQuery<TResult>;

These interfaces unify CQRS semantics across modules and improve discoverability.


πŸ“š Repository Abstractions

This library defines two essential repository contracts.


IReadRepository<T>

Read-only operations using Specification pattern:

Task<T?> GetByIdAsync<TId>(TId id, CancellationToken cancellationToken);
Task<IReadOnlyList<T>> ListAsync(ISpecification<T> specification);

IRepository<T>

Adds stateful write capabilities:

Task AddAsync(T entity);
Task UpdateAsync(T entity);
Task DeleteAsync(T entity);

These interfaces pair with Geaux.Specification and Geaux.Specification.EntityFrameworkCore.


πŸ“œ Logging Behavior

Includes LoggingBehavior<TRequest, TResponse> to integrate into the MediatR pipeline:

  • Logs request start/end
  • Captures timing
  • Helps track application flow consistently

πŸ› Architectural Role

Geaux.SharedKernal sits at the center of the dependency graph.

It may be referenced by:

  • Domain projects (Geaux.Core)
  • Use case projects (Geaux.UseCases)
  • Infrastructure implementations (read-only)

It must not reference:

  • EF Core
  • ASP.NET Core
  • Infrastructure
  • UI or Presentation layers

This enforces pure domain compliance.


πŸ“‚ Project Structure

Geaux.SharedKernal/
β”‚
β”œβ”€β”€ CQRS/
β”‚   β”œβ”€β”€ ICommand.cs
β”‚   β”œβ”€β”€ ICommandHandler.cs
β”‚   β”œβ”€β”€ IQuery.cs
β”‚   └── IQueryHandler.cs
β”‚
β”œβ”€β”€ DomainEvents/
β”‚   β”œβ”€β”€ DomainEventBase.cs
β”‚   β”œβ”€β”€ IDomainEventDispatcher.cs
β”‚   β”œβ”€β”€ MediatRDomainEventDispatcher.cs
β”‚   └── LoggingBehavior.cs
β”‚
β”œβ”€β”€ Entities/
β”‚   β”œβ”€β”€ EntityBase.cs
β”‚   β”œβ”€β”€ EntityBase.TId.cs
β”‚   β”œβ”€β”€ ValueObject.cs
β”‚   β”œβ”€β”€ HasDomainEventsBase.cs
β”‚   └── IAggregateRoot.cs
β”‚
β”œβ”€β”€ Repositories/
β”‚   β”œβ”€β”€ IRepository.cs
β”‚   └── IReadRepository.cs
β”‚
└── Geaux.SharedKernal.csproj

πŸ“˜ Usage Summary

Geaux.SharedKernal provides:

  • The base types for all domain models
  • Building blocks for domain events
  • Command/query abstractions
  • Repository contracts
  • MediatR pipeline utilities

It is the foundational library for building decoupled, testable, scalable applications following Clean Architecture and DDD practices.


πŸ“„ License

MIT License Β© Brent Lee Rigsby / GeauxCajunIT


🌐 Repository

https://github.com/GeauxCajunIT/GeauxPlatform

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 Geaux.SharedKernal:

Package Downloads
Geaux.Localization

Geaux.Localization is a database-backed localization provider for .NET with multi-tenant support, EF Core integration, culture fallback, attribute-based localization, and export/import tooling.

Geaux.Localization.Admin

Geaux.Localization.Admin provides a plug‑and‑play Razor Class Library admin dashboard for managing localization keys, cultures, translations, and language packs. Includes CSV/JSON/ZIP export and import tooling, missing‑value repair, and multi‑tenant support.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 344 12/17/2025

* Added IAuditable interface for created/modified timestamps
* Added ISoftDelete interface for logical deletion support
* Updated EntityBase to implement IEntityBase<TId> with audit trail
* Documentation improvements and DocFX stubs for new features