EricksonLopez.SharedKernel

dotnet-shared-kernel · Modelado de Dominio

En esta página (20 secciones)

1. Identidad, Nivel y Perfil de Madurez#

L1 Modelado de Dominio y ConsultasEstableMantenimiento: ActivoAOT: CompletoLicencia MITConfianza: HIGH
DomainApplicationnet8.0net9.0net10.0

2. Propuesta de Valor y Problema que Resuelve#

Battle-tested DDD abstractions and shared kernel for Clean Architecture .NET applications.

Las implementaciones DDD suelen acoplar rastreo de ORM, asignaciones innecesarias de listas de eventos e IDs primitivos sin tipado fuerte en los agregados.

3. Instalación Rápida#

Paquete principal: EricksonLopez.SharedKernel

dotnet add package EricksonLopez.SharedKernel --version 4.0.0
También publicado en esta familia:
EricksonLopez.SharedKernel.TestingEricksonLopez.SharedKernel.OpenTelemetryEricksonLopez.SharedKernel.DapperEricksonLopez.SharedKernel.JsonEricksonLopez.SharedKernel.EntityFrameworkCoreEricksonLopez.SharedKernel.SourceGenerators

4. Métricas Verificadas del Ecosistema#

v4.0.0
Versión Publicada en NuGet
v5.0.1
Versión HEAD del Repo
3,092
Descargas en NuGet
8
Paquetes Empaquetables
188
Miembros Públicos de API
53
Filas Benchmark (RyuJIT)

Instantánea recuperada UTC: 2026-12-01

5. Cuándo Usar y Cuándo NO Usar#

Cuándo usar

  • Necesitas clases base AggregateRoot<TId>, Entity<TId>, AuditableEntity<TId> y almacenamiento diferido de eventos de dominio.
  • Integras EricksonLopez.DomainPrimitives y EricksonLopez.Events con EF Core o Dapper.

Cuándo NO usar

  • Solo requieres value objects aislados sin ciclo de vida Entity/AggregateRoot; usa DomainPrimitives o ValueObjects.

6. Capacidades Principales e Invariantes de Diseño#

Almacenamiento Diferido de Eventos

Cero asignaciones de listas de eventos durante la hidratación de solo lectura hasta que se emite un evento.

Integración con EF Core y Dapper

Incluye interceptor SaveChanges para eventos de dominio y type handlers de Dapper generados en compilación para StrongIds.

7. Paquetes NuGet y Adaptadores Incluidos#

ID del PaqueteEstadoNuGet / LocalTFMsEstado AOTDescargasDescripción
EricksonLopez.SharedKernelPrincipalPublicadov4.0.0 / v5.0.1net8.0, net9.0, net10.0AOT: Completo1,342A minimal Shared Kernel for DDD-based .NET applications. Provides zero-dependency, AOT-compatible domain primitives: Entity<TId>, AggregateRoot<TId>, DomainEvent, and OperationTimeContext. Designed for Clean Architecture and CQRS. NativeAOT and Trimming compatible on all supported TFMs.
EricksonLopez.SharedKernel.TestingPublicadov4.0.0 / v5.0.1net8.0, net9.0, net10.0AOT: Completo308Testing SDK for EricksonLopez.SharedKernel. Provides domain event collectors, assertions, and test helpers for aggregate roots.
EricksonLopez.SharedKernel.OpenTelemetryPublicadov4.0.0 / v5.0.1net8.0, net9.0, net10.0AOT: Completo306OpenTelemetry tracing and metrics instrumentation for EricksonLopez.SharedKernel domain events. NativeAOT and Trimming compatible.
EricksonLopez.SharedKernel.DapperPublicadov4.0.0 / v5.0.1net8.0, net9.0, net10.0AOT: Completo302Dapper TypeHandler adapters and registration extensions for EricksonLopez.SharedKernel strong identifiers.
EricksonLopez.SharedKernel.JsonPublicadov4.0.0 / v5.0.1net8.0, net9.0, net10.0AOT: Completo288System.Text.Json dynamic converter factory and serialization adapters for EricksonLopez.SharedKernel strong identifiers.
EricksonLopez.SharedKernel.EntityFrameworkCorePublicadov4.0.0 / v5.0.1net8.0, net9.0, net10.0AOT: Completo272Entity Framework Core integration for EricksonLopez.SharedKernel. Provides NativeAOT-ready StrongId value converters, DomainEventsInterceptor for automatic event draining on SaveChanges, and ModelBuilder conventions.
EricksonLopez.SharedKernel.SourceGeneratorsAnalizador / GeneradorPublicadov4.0.0 / v5.0.1netstandard2.0AOT: N/A (Analizador/Legado)274Roslyn Incremental Source Generators for EricksonLopez.SharedKernel. Generates zero-reflection, Native AOT-safe Dapper bulk registrations and domain metadata.
EricksonLopez.SharedKernel.PersistenceNo publicado— / v5.0.1net8.0, net9.0, net10.0AOT: Completo0Compile-time persistence metadata attributes and entity descriptors for EricksonLopez.SharedKernel.

8. Ejemplo Quick Start#

Basado en APIs públicas verificadas de EricksonLopez.SharedKernel. Compila con `<ImplicitUsings>disable</ImplicitUsings>` e importaciones explícitas.

using System;
using EricksonLopez.SharedKernel;

public readonly record struct OrderId(Guid Value);

public sealed record OrderPlacedEvent(OrderId OrderId, decimal TotalAmount) : DomainEvent;

public sealed class Order : AggregateRoot<OrderId>
{
    public decimal TotalAmount { get; private set; }

    private Order(OrderId id, decimal totalAmount) : base(id)
    {
        TotalAmount = totalAmount;
    }

    public static Order Place(OrderId id, decimal totalAmount)
    {
        ArgumentOutOfRangeException.ThrowIfNegativeOrZero(totalAmount);
        var order = new Order(id, totalAmount);
        order.RaiseDomainEvent(new OrderPlacedEvent(id, totalAmount));
        return order;
    }
}

9. Arquitectura y Flujo de Dependencias#

flowchart LR
  lib_shared_kernel["EricksonLopez.SharedKernel (L1)"]
  lib_domain_primitives["EricksonLopez.DomainPrimitives (L0)"]
  lib_shared_kernel --> lib_domain_primitives
  lib_events["EricksonLopez.Events (L0)"]
  lib_shared_kernel --> lib_events
Topología de Dependencias de EricksonLopez.SharedKernel2 dependencias hacia librerías aguas arriba y 0 librerías dependientes aguas abajo verificadas en dependencies.json.
Ver descripción textual y tabla accesible

2 dependencias hacia librerías aguas arriba y 0 librerías dependientes aguas abajo verificadas en dependencies.json.

DirecciónLibreríaNivelTipos de Relación
Aguas arribaEricksonLopez.DomainPrimitivesL0Adaptador, Tiempo de compilación, Paquete NuGet
Aguas arribaEricksonLopez.EventsL0Tiempo de compilación, Paquete NuGet
flowchart LR
  lib_shared_kernel["EricksonLopez.SharedKernel (L1)"]
  lib_domain_primitives["EricksonLopez.DomainPrimitives (L0)"]
  lib_shared_kernel --> lib_domain_primitives
  lib_events["EricksonLopez.Events (L0)"]
  lib_shared_kernel --> lib_events

10. Target Frameworks y Matriz Native AOT / Trimming#

Inspección MSBuild `.csproj` sobre 8 paquetes: 7 Full, 0 Partial, 0 Incompatible, 1 NotApplicable (analizadores/generadores).

ID del PaqueteIsAotCompatibleEnableTrimAnalyzerEstado AOT VerificadoTarget Frameworks
EricksonLopez.SharedKerneltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SharedKernel.TestingtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SharedKernel.OpenTelemetrytruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SharedKernel.DappertruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SharedKernel.JsontruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SharedKernel.EntityFrameworkCoretruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SharedKernel.SourceGeneratorsnullfalseNotApplicablenetstandard2.0
EricksonLopez.SharedKernel.PersistencetruetrueFullnet8.0, net9.0, net10.0

11. Dependencias Aguas Arriba y Dependientes Aguas Abajo#

Dependencias Aguas Arriba (2)

Dependientes Aguas Abajo (0)

Ninguna otra librería EricksonLopez.* depende actualmente de esta familia.

12. Adaptadores Opcionales e Integraciones Externas#

Aristas de Adaptadores Internos y Paquetes de Integración

Dependencias NuGet Externas Verificadas (4)

DapperMicrosoft.EntityFrameworkCoreMicrosoft.Extensions.DependencyInjection.AbstractionsOpenTelemetry.Api

13. Resumen de Configuración y Registro en DI#

Puntos de Entrada DI y Configuración Verificados

  • SharedKernelModelConfigurationExtensions.ConfigureStrongId<TId, TValue>

    Configures a `StrongIdValueConverter<TId, TValue>` for the specified strongly-typed identifier type.

  • SharedKernelModelConfigurationExtensions.ConfigureStrongIdsFromAssemblies

    Scans multiple assemblies and configures value converters for all concrete types implementing `IStrongId<TSelf, TValue>`.

  • SharedKernelModelConfigurationExtensions.ConfigureStrongIdsFromAssembly

    Scans the specified assembly and configures value converters for all concrete types implementing `IStrongId<TSelf, TValue>`.

  • SharedKernelEntityFrameworkServiceCollectionExtensions.AddSharedKernelDomainEventsInterceptor

    Registers the `DomainEventsInterceptor` as a scoped `ISaveChangesInterceptor` in the service collection.

  • SharedKernelEntityFrameworkServiceCollectionExtensions.AddSharedKernelDomainEventsInterceptor<TDispatcher>

    Registers a concrete `IDomainEventDispatcher` implementation and the `DomainEventsInterceptor` as scoped services in the service collection.

  • SharedKernelOpenTelemetryExtensions.AddSharedKernelInstrumentation

    Adds the SharedKernel diagnostic `Metrics.Meter` to the meter provider builder.

Tipos Públicos y Contratos Clave

  • EricksonLopez.SharedKernel.AggregateRoot`1 (class)

    Represents an abstract base class for aggregate roots that define transactional consistency boundaries in Domain-Driven Design.

  • EricksonLopez.SharedKernel.AuditableAggregateRoot`1 (class)

    Represents an abstract base class for aggregate roots that track temporal and actor audit metadata.

  • EricksonLopez.SharedKernel.AuditableEntity`1 (class)

    Represents an abstract base class for domain entities that track temporal and actor audit metadata.

  • EricksonLopez.SharedKernel.DomainEvent (record)

    Represents an abstract base record for immutable domain events.

  • EricksonLopez.SharedKernel.DomainEventIdentityEqualityComparer (class)

    Provides equality comparison for domain events based strictly on their unique identifier (`DomainEvent.Id`).

  • EricksonLopez.SharedKernel.Entity`1 (class)

    Represents an abstract base class for domain entities whose equality is determined by runtime type and identity.

  • EricksonLopez.SharedKernel.IAggregateRoot (interface)

    Defines an aggregate root that acts as the transactional consistency boundary of a domain model.

  • EricksonLopez.SharedKernel.IAuditableEntity (interface)

    Defines temporal and actor audit metadata for entities and aggregate roots.

  • EricksonLopez.SharedKernel.IDomainEventDispatcher (interface)

    Defines the contract for dispatching domain events collected from domain entities.

  • EricksonLopez.SharedKernel.IEntity (interface)

    Defines a non-generic marker contract for domain entities.

  • EricksonLopez.SharedKernel.IEntityId (interface)

    Defines the non-generic contract for Guid-backed strongly-typed domain entity identifiers.

  • EricksonLopez.SharedKernel.IEntityId`1 (interface)

    Defines the generic contract for Guid-backed strongly-typed domain entity identifiers supporting zero-reflection instantiation.

14. Benchmarks de Rendimiento Verificados#

Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).

Filas totales: 53 · Medidos: 22 · NA / Error: 31 · Suites: 4

Runtimes observados: .NET 10.0.10 X64 RyuJIT x86-64-v4 · .NET 10.0.12 X64 RyuJIT x86-64-v4 · .NET 8.0 (JIT) · .NET 9.0 (JIT)

CPUs observadas: AMD EPYC 9V45 4.49GHz, 1 CPU, 4 logical and 2 physical cores · AMD Ryzen 7 9800X3D 4.70GHz, 1 CPU, 8 logical and 8 physical cores

SuiteMétodoRuntimeMedia (ns)Asignado (B)Estado
EntityComparisonBenchmarksArdalis_EntityEquality_SameId.NET 10.0.12 X64 RyuJIT x86-64-v40.0020measured
EntityComparisonBenchmarksEricksonLopez_EntityEquality_DifferentId.NET 10.0.12 X64 RyuJIT x86-64-v40.0020measured
SharedKernelBenchmarksResultSuccess.NET 10.0.10 X64 RyuJIT x86-64-v40.0040measured
SharedKernelBenchmarksAggregateDomainEventsAccessNoEvents.NET 10.0.10 X64 RyuJIT x86-64-v40.0110measured
SharedKernelBenchmarksEntityEquality_DifferentId.NET 10.0.12 X64 RyuJIT x86-64-v40.0140measured
SharedKernelBenchmarksEntityEquality_SameId.NET 10.0.12 X64 RyuJIT x86-64-v40.0170measured
EntityComparisonBenchmarksArdalis_EntityEquality_DifferentId.NET 10.0.12 X64 RyuJIT x86-64-v40.0410measured
EntityComparisonBenchmarksEricksonLopez_EntityEquality_SameId.NET 10.0.12 X64 RyuJIT x86-64-v40.0440measured
SharedKernelBenchmarksAggregateDrainDomainEvents_NoEvents.NET 10.0.12 X64 RyuJIT x86-64-v40.3430measured
SharedKernelBenchmarksEntityEquality.NET 10.0.10 X64 RyuJIT x86-64-v40.3850measured
SharedKernelBenchmarksResultFailure.NET 10.0.10 X64 RyuJIT x86-64-v40.7970measured
SharedKernelBenchmarksEntityGetHashCode.NET 10.0.12 X64 RyuJIT x86-64-v43.2140measured
AggregateHydrationBenchmarksEricksonLopez_AggregateHydration_ZeroEvents.NET 10.0.12 X64 RyuJIT x86-64-v43.640measured
AggregateHydrationBenchmarksArdalis_AggregateHydration_ZeroEvents.NET 10.0.12 X64 RyuJIT x86-64-v48.7372measured
AggregateHydrationBenchmarksEricksonLopez_DrainEvents_WithEvents.NET 10.0.12 X64 RyuJIT x86-64-v416.132112measured
SharedKernelBenchmarksAggregateDrainDomainEvents_WithEvents.NET 10.0.12 X64 RyuJIT x86-64-v417.221112measured
SharedKernelBenchmarksAggregateRaiseDomainEvent_FirstTime.NET 10.0.12 X64 RyuJIT x86-64-v418.168128measured
AggregateHydrationBenchmarksArdalis_DrainEvents_WithEvents.NET 10.0.12 X64 RyuJIT x86-64-v443.889200measured
ResultBenchmarksCreateFailure.NET 10.0.10 X64 RyuJIT x86-64-v4169,10032measured
ResultBenchmarksCreateSuccess.NET 10.0.10 X64 RyuJIT x86-64-v4199,1000measured
ResultBenchmarksSyncPipeline_Tap.NET 10.0.10 X64 RyuJIT x86-64-v4303,3000measured
ResultBenchmarksAsyncPipeline_Tap.NET 10.0.10 X64 RyuJIT x86-64-v42,621,100248measured

15. Historial de Versiones y Estado NuGet vs Repositorio#

Desfase de versiones detectado: la última versión publicada en NuGet.org es v4.0.0, mientras el HEAD del repositorio local está en v5.0.1.

VersiónOrigenFecha de PublicaciónResumen
v4.0.0 ↗nuget2026-09-21Published EricksonLopez.SharedKernel 4.0.0 to NuGet.org.
v4.0.0 ↗github2026-09-21Ecosystem Packages in this release - `EricksonLopez.SharedKernel` - `EricksonLopez.SharedKernel.EntityFrameworkCore` - `EricksonLopez.SharedKernel.Dapper` - `EricksonLopez.SharedKernel.Json` - `EricksonLopez.SharedKernel.SourceGenerators` - `EricksonLopez.SharedKernel.OpenTelemetry` - `EricksonLopez.SharedKernel.Testing`
v3.0.0 ↗nuget2026-08-25Published EricksonLopez.SharedKernel 3.0.0 to NuGet.org.
v3.0.0 ↗github2026-08-25Ecosystem Packages in this release - `EricksonLopez.SharedKernel` - `EricksonLopez.SharedKernel.EntityFrameworkCore` - `EricksonLopez.SharedKernel.Dapper` - `EricksonLopez.SharedKernel.Json` - `EricksonLopez.SharedKernel.SourceGenerators` - `EricksonLopez.SharedKernel.OpenTelemetry` - `EricksonLopez.SharedKernel.Testing`
v2.0.0 ↗nuget2026-08-12Published EricksonLopez.SharedKernel 2.0.0 to NuGet.org.
v2.0.0 ↗github2026-08-12Products in this release - **EricksonLopez.SharedKernel** `2.0.0` – [CHANGELOG](https://github.com/ericksonlopezf/dotnet-shared-kernel/blob/v2.0.0/CHANGELOG.md) --- For detailed changes, see the linked changelog above.
v1.1.0 ↗github2026-07-23Products in this release - **EricksonLopez.SharedKernel** `1.1.0` – [CHANGELOG](https://github.com/ericksonlopezf/dotnet-shared-kernel/blob/v1.1.0/CHANGELOG.md) --- For detailed changes, see the linked changelog above. Installation ```bash dotnet add package EricksonLopez.SharedKernel --version 1.1.0 ```
v1.1.0 ↗nuget2026-07-23Published EricksonLopez.SharedKernel 1.1.0 to NuGet.org.
v1.0.1 ↗github2026-07-21See [CHANGELOG.md](https://github.com/ericksonlopezf/dotnet-shared-kernel/blob/main/CHANGELOG.md) for details.
v1.0.1 ↗nuget2026-07-21Published EricksonLopez.SharedKernel 1.0.1 to NuGet.org.
v1.0.0 ↗github2026-07-16See [CHANGELOG.md](https://github.com/ericksonlopezf/dotnet-shared-kernel/blob/main/CHANGELOG.md) for details.
v1.0.0 ↗nuget2026-07-16Published EricksonLopez.SharedKernel 1.0.0 to NuGet.org.

Librerías en el mismo nivel, capa arquitectónica o vinculadas directamente mediante aristas de dependencia.

17. Documentación, API Reference y Enlaces del Portal#

Las páginas conceptuales por librería en Starlight se completan en M4; las páginas de API Reference en M3.2.

18. Repositorio Fuente, Licencia y Contribución#

Publicado bajo Licencia MIT. Todos los ensamblados cumplen los invariantes de compilación EricksonLopez.*: importaciones explícitas, firma fuerte (`EricksonLopez.snk`) y metadatos de autor en ASCII (`Erickson Lopez`).

19. Resolución de Problemas, Riesgos y Migración#

  • Registra ConfigureStrongIdsFromAssembly en la configuración del modelo EF Core para mapear StrongIds sin reflexión en tiempo de ejecución.
  • Desfase de versiones detectado: la última versión publicada en NuGet.org es v4.0.0, mientras el HEAD del repositorio local está en v5.0.1.

20. Evidencia de Calidad y Verificación#

Firma Fuerte (`EricksonLopez.snk`)
EricksonLopez.snk
`ImplicitUsings=disable`
disable
Extracción de Documentación XML
Verificado (10 namespaces, 47 tipos, 188 miembros)
Atributos MSBuild AOT / Trimming
7 Full / 0 Partial / 0 Incompatible / 1 N/A
Artefactos BenchmarkDotNet
53 total (22 measured, 31 na_error)

Límites Explícitos de Verificación y Alcance

  • Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).
  • 1 no publicados

Buscar en el Ecosistema EricksonLopez.*

Escribe el nombre de una librería, ID de paquete NuGet, tipo .NET o concepto arquitectónico para buscar en el portal.