EricksonLopez.SharedKernel
2.0.0
See the version list below for details.
dotnet add package EricksonLopez.SharedKernel --version 2.0.0
NuGet\Install-Package EricksonLopez.SharedKernel -Version 2.0.0
<PackageReference Include="EricksonLopez.SharedKernel" Version="2.0.0" />
<PackageVersion Include="EricksonLopez.SharedKernel" Version="2.0.0" />
<PackageReference Include="EricksonLopez.SharedKernel" />
paket add EricksonLopez.SharedKernel --version 2.0.0
#r "nuget: EricksonLopez.SharedKernel, 2.0.0"
#:package EricksonLopez.SharedKernel@2.0.0
#addin nuget:?package=EricksonLopez.SharedKernel&version=2.0.0
#tool nuget:?package=EricksonLopez.SharedKernel&version=2.0.0
EricksonLopez.SharedKernel
A minimal, high-performance Shared Kernel for DDD-based .NET applications. Provides zero-dependency, AOT-compatible domain primitives: Entity<TId>, AggregateRoot<TId>, and IDomainEvent. Designed for Clean Architecture and CQRS.
⚡ Performance
BenchmarkDotNet v0.14.0 · .NET 10.0 · X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Focus: Extreme low allocation for domain event sourcing.
Event Sourcing — Lazy Allocation
| Method | Mean | Allocated | Alloc Ratio |
|---|---|---|---|
RaiseEvent_FirstTime |
12.4 ns | 64 B | 1.0× |
RaiseEvent_Subsequent |
5.2 ns | 0 B | 0.0× |
ClearEvents |
1.1 ns | 0 B | 0.0× |
Key takeaways:
- Zero-allocation domain events collection until the first event is raised.
- Minimal
64 Ballocation strictly for the backing list on the first event. - O(1) clearing of events with absolutely zero allocations.
Key Features
- Zero Dependencies: Keep your core domain pure. No third-party dependencies.
- AOT Ready:
IsAotCompatible=trueandIsTrimmable=trueare active on all supported TFMs, providing real Native AOT compatibility analysis at compile time. - Lazy Allocation: Domain event collections allocate memory strictly when the first event is raised, optimizing memory footprint.
- Identity Equality: Pre-optimized
GetHashCode()and equality operators (==,!=) out of the box for Domain Entities.
What's Included
| Type | Description |
|---|---|
Entity<TId> |
Abstract base for domain entities with identity-based equality (type + Id). Includes IsTransient(), ==/!= operators, and an optimized GetHashCode(). |
AggregateRoot<TId> |
Transactional consistency boundary. Inherits Entity<TId> and adds domain event support with lazy allocation. |
IDomainEvent |
Marker interface for domain events. |
This library intentionally does not include infrastructure abstractions (UnitOfWork, Repositories) or additional patterns (Result, ValueObject, Specification). The goal is to keep the domain core completely pure and dependency-free.
.NET Framework Support Policy
All library packages target net8.0, net9.0, and net10.0.
Support Policy: This library supports only .NET frameworks with active official support from Microsoft. A framework version is included in
TargetFrameworksas long as it appears on the Microsoft .NET Support Policy page under Active or Maintenance status. Framework versions are removed fromTargetFrameworkswhen they reach their official end-of-life date as defined by Microsoft — not before, and not after.
Framework Type Microsoft Support End Date Status .NET 8 LTS November 10, 2026 ✅ Supported .NET 9 STS November 10, 2026 ✅ Supported .NET 10 LTS November 2028 ✅ Supported
Quick Start
Install the package:
dotnet add package EricksonLopez.SharedKernelStart using the domain primitives:
using EricksonLopez.SharedKernel; // 1. Define a domain event public sealed record OrderPlacedEvent(Guid OrderId) : IDomainEvent; // 2. Define an Aggregate Root public sealed class Order : AggregateRoot<Guid> { private Order() { } public static Order Place(Guid id) { var order = new Order { Id = id }; order.RaiseDomainEvent(new OrderPlacedEvent(id)); return order; } } // 3. Use it var order = Order.Place(Guid.NewGuid()); Console.WriteLine(order.DomainEvents.Count); // 1 order.ClearDomainEvents();
Showcase
The repository includes a runnable reference project at samples/EricksonLopez.SharedKernel.Sample/. It demonstrates all public API members across multiple use-case levels.
dotnet run --project samples/EricksonLopez.SharedKernel.Sample/EricksonLopez.SharedKernel.Sample.csproj
Documentation
| Topic | Link |
|---|---|
| Quick Start | docs/QUICK_START.md |
| Getting Started | docs/GETTING_STARTED.md |
| API Reference | docs/API_REFERENCE.md |
| Cookbook | docs/Cookbook.md |
| Best Practices | docs/BestPractices.md |
| Anti-Patterns | docs/AntiPatterns.md |
| Architecture Guide | docs/Architecture.md |
| Performance Guide | docs/PERFORMANCE_GUIDE.md |
| Migration Guide | docs/MigrationGuide.md |
| CI/CD Pipeline | docs/ci-cd.md |
| FAQ | docs/FAQ.md |
| Troubleshooting | docs/TROUBLESHOOTING.md |
| Design Decisions (ADRs) | docs/decisions/ |
Contributing
See CONTRIBUTING.md for information on building the project, running tests, and contributing guidelines.
Security
Please review SECURITY.md for details on our security policies and how to report vulnerabilities.
Code of Conduct
We follow the Contributor Covenant. See CODE_OF_CONDUCT.md for details.
License
This project is licensed under the MIT License — see the LICENSE file for details.
| Product | Versions 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 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (6)
Showing the top 5 NuGet packages that depend on EricksonLopez.SharedKernel:
| Package | Downloads |
|---|---|
|
EricksonLopez.DapperExtensions.PostgreSQL
High-performance Dapper extensions for PostgreSQL. Bulk insert and upsert via UNNEST (10-50x faster than row-by-row), paginated queries returning PagedList<T>, transaction helpers, and JSONB type handler. Designed for enterprise .NET applications using Clean Architecture. |
|
|
EricksonLopez.SharedKernel.Testing
Testing SDK for EricksonLopez.SharedKernel. Provides domain event collectors, assertions, and test helpers for aggregate roots. |
|
|
EricksonLopez.SharedKernel.OpenTelemetry
OpenTelemetry tracing and metrics instrumentation for EricksonLopez.SharedKernel domain events. NativeAOT and Trimming compatible. |
|
|
EricksonLopez.SharedKernel.Dapper
Dapper TypeHandler adapters and registration extensions for EricksonLopez.SharedKernel strong identifiers. |
|
|
EricksonLopez.SharedKernel.EntityFrameworkCore
Entity Framework Core integration for EricksonLopez.SharedKernel. Provides NativeAOT-ready StrongId value converters, DomainEventsInterceptor for automatic event draining on SaveChanges, and ModelBuilder conventions. |
GitHub repositories
This package is not used by any popular GitHub repositories.