Foundational domain-driven building blocks for .NET applications. Provides CQRS primitives, domain events, entity base classes, value objects, repository abstractions, audit trail, and soft delete support.
$ dotnet add package Geaux.SharedKernalFoundational 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.
IRepository, IReadRepository) compatible with Specification patternIAuditable) for created/modified timestampsISoftDelete) for logical deletion supportdotnet add package Geaux.SharedKernal
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)A base class for aggregate roots or domain entities.
EntityBase<TId>) and non-generic versionspublic class Order : EntityBase<Guid>, IAggregateRoot
{
public DateTime CreatedOn { get; private set; } = DateTime.UtcNow;
}
Implements the classic DDD Value Object pattern using component-based equality.
IComparablepublic 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 allow aggregates to publish meaningful system changes.
public abstract class DomainEventBase : INotification
{
public DateTime DateOccurred { get; } = DateTime.UtcNow;
}
Each event is attached to an entity and later dispatched.
Abstraction that hands domain events off to an external mechanism (such as MediatR).
A concrete implementation using MediatR:
Geaux.SharedKernal defines command/query primitives compatible with MediatR.
public interface ICommand<TResult> : IRequest<TResult> { }
public interface ICommandHandler<TCommand, TResult>
: IRequestHandler<TCommand, TResult> where TCommand : ICommand<TResult>;
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.
This library defines two essential repository contracts.
Read-only operations using Specification pattern:
Task<T?> GetByIdAsync<TId>(TId id, CancellationToken cancellationToken);
Task<IReadOnlyList<T>> ListAsync(ISpecification<T> specification);
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.
Includes LoggingBehavior<TRequest, TResponse> to integrate into the MediatR pipeline:
Geaux.SharedKernal sits at the center of the dependency graph.
Geaux.Core)Geaux.UseCases)This enforces pure domain compliance.
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
Geaux.SharedKernal provides:
It is the foundational library for building decoupled, testable, scalable applications following Clean Architecture and DDD practices.
MIT License © Brent Lee Rigsby / GeauxCajunIT