Use this file to discover all available pages before exploring further.
SharedKernel is published as 12 focused NuGet packages organised by Clean Architecture layer. Each package targets .NET 10 and carries only the dependencies it genuinely needs — you pull in the packages that match the layers you are building, keeping your final binary free from unnecessary transitive dependencies.
All SharedKernel packages follow semantic versioning and are published to nuget.org. Pin your versions centrally (e.g. with Directory.Packages.props) to keep every layer of your solution aligned.
The Core packages provide the lowest-level shared contracts and utility infrastructure that every other layer depends on. They carry no domain or application semantics.
JordiAragonZaragoza.SharedKernel
Utility helpers and DI markup interfaces.Depends on Microsoft.Extensions.DependencyInjection, Microsoft.Extensions.Configuration, and the SharedKernel.Contracts project.
Key type
Purpose
DI markup interfaces
Auto-registration of scoped/transient/singleton services by convention
Configuration helpers
Strongly typed options binding utilities
JordiAragonZaragoza.SharedKernel.Contracts
Cross-cutting abstraction interfaces (no implementations).Zero external NuGet dependencies — safe to reference from any layer.
The Domain packages contain every DDD building block your model needs. Domain.Contracts holds pure interfaces; Domain provides concrete base classes.
JordiAragonZaragoza.SharedKernel.Domain.Contracts
Pure domain interface contracts.No NuGet dependencies. Reference this from any project that needs to declare domain types without pulling in implementations.
Key type
Purpose
IAggregateRoot<TId>
Marks an entity as an aggregate root with event collection
IEventSourcedAggregateRoot<TId>
Extends IAggregateRoot for event-sourced aggregates
IEntity<TId>
Strongly typed entity identity contract
IEntityId / IEntityId<TIdType>
Value-object ID contract
IDomainEvent
Marker for domain events with Id, AggregateId, DateOccurredOnUtc
IBusinessRule
Message + IsBroken() for guard-clause validation
IEventBus
In-process domain-event dispatch contract
IEventsDispatcherService
Service contract for draining aggregate event queues
IDomainService
Marker for domain service classes
IAggregateStore
Repository contract for event-sourced aggregates
JordiAragonZaragoza.SharedKernel.Domain
Concrete DDD building blocks.Depends on SharedKernel, SharedKernel.Domain.Contracts, Ardalis.SmartEnum, and Microsoft.Extensions.Logging.
Key type
Purpose
BaseAggregateRoot<TId>
Aggregate root with Apply(), When(), EnsureValidState(), and event collection
BaseEventSourcedAggregateRoot<TId>
Event-sourced variant — state is fully rehydrated from events
BaseEntity<TId>
Entity base with structural equality and CheckRule()
BaseValueObject
Value object with GetEqualityComponents(), cached hash code, ==/!= operators
BaseEntityId<TIdType>
Value-object ID with implicit conversion to the underlying primitive
BaseAggregateRootId<TId>
Specialisation of BaseEntityId for aggregate roots
BaseDomainEvent(AggregateId)
Abstract record class base for all domain events
SmartEnum
Re-exported Ardalis SmartEnum base for type-safe enumerations
The Application packages wire CQRS abstractions, MediatR pipeline behaviors, integration-event contracts, and validation helpers. They sit between the domain and the infrastructure.
Cross-service integration messaging contracts.No external NuGet dependencies — safe to share between service boundaries.
Key type
Purpose
IIntegrationEvent
Marker for events published across service boundaries
IIntegrationCommand
Cross-service command contract
IIntegrationQuery
Cross-service query contract
IIntegrationEventBus
Publish integration events
IIntegrationCommandBus
Send integration commands
IIntegrationQueryBus
Send integration queries
IIntegrationMessage
Common base for all integration message types
JordiAragonZaragoza.SharedKernel.Application
Pipeline behavior implementations and DI extensions.Depends on SharedKernel.Application.Contracts, SharedKernel.Domain, FluentValidation, Ardalis.Result.FluentValidation, and Microsoft.Extensions.Logging.
Key type
Purpose
RequestLoggerService
Structured logging for every request
RequestExceptionHandlerService
Translates unhandled exceptions to Result.Error
RequestUnitOfWorkService
Wraps command handlers in a SaveChangesAsync transaction
RequestAuthorizationService<,>
Policy-based authorization check before handling
RequestValidationService<,>
FluentValidation execution; returns Result.Invalid on failure
RequestCachingService
Response caching for ICacheRequest queries
RequestInvalidateCachingService
Cache eviction for IInvalidateCacheRequest commands
Infrastructure packages contain concrete adapters: the MediatR bus, EF Core contexts and repositories, and the KurrentDB event store.
JordiAragonZaragoza.SharedKernel.Infrastructure
MediatR bus wires, caching, context services, and DI helpers.Depends on SharedKernel, SharedKernel.Application, SharedKernel.Domain, MassTransit, MassTransit.RabbitMQ, Ardalis.Result, FluentValidation, and Microsoft.Extensions.Options.
Key type
Purpose
CommandBus
ICommandBus implementation via MediatR
QueryBus
IQueryBus implementation via MediatR
InMemoryEventBus
IEventBus implementation for in-process domain-event dispatch
CacheService
ICacheService implementation using IMemoryCache / IDistributedCache
EF Core base contexts and Ardalis Specification repositories.Depends on Ardalis.Specification.EntityFrameworkCore, Ardalis.SmartEnum.EFCore, and Microsoft.EntityFrameworkCore.
Key type
Purpose
BaseContext
Base DbContext that configures logging, sensitive-data logging, and Ardalis SmartEnum EF Core conventions
BaseBusinessModelContext
Specialised context for the write (business model) side
BaseReadModelContext
Specialised context for the read-model / projections side
BaseProjectionsStore
EF Core store for projection read models
BaseRepository<T, TId>
Full read/write repository implementing Ardalis IRepository
Presentation packages add HTTP and messaging surface to your application. They depend on the Application contracts but remain ignorant of Infrastructure internals.
ASP.NET Core controllers, middleware, and response helpers.Depends on FastEndpoints, Ardalis.Result, SharedKernel.Application.Contracts, and SharedKernel.Infrastructure.
Key type
Purpose
BaseApiCommandController
ControllerBase subclass pre-wired with ICommandBus
BaseApiQueryController
ControllerBase subclass pre-wired with IQueryBus
ExceptionMiddleware
Converts unhandled exceptions to ProblemDetails JSON responses
UserContextMiddleware
Populates IUserContextService from the JWT bearer token
PartitionContextMiddleware
Populates IPartitionContextService from request headers or claims
ResponseBuilderHelper
Maps Result<T> to typed ActionResult<T> with correct HTTP status codes
ResultExtensions
Extension methods for translating Result to IResult (minimal APIs)
MassTransit integration event bus producers and consumers.Depends on MassTransit, MassTransit.RabbitMQ, and SharedKernel.Application.Contracts.Integration.
Key type
Purpose
IntegrationEventBus
IIntegrationEventBus implementation publishing via MassTransit
Integration consumers
Base consumer wiring for receiving integration events
Integration producers
Helpers for publishing integration events to the message broker
Integration presentation contracts.No infrastructure dependencies — safe to reference from any service that needs to describe integration message shapes.
Key type
Purpose
IIntegrationEventHandler<T>
Consumer handler contract for integration events
Integration message base types
Shared record bases for versioned integration messages