Public .NET API ReferenceL1 Domain & Query ModelingStableAOT: Full

EricksonLopez.SharedKernel

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

10 namespaces47 types188 membersGenerated from XML docs & assemblies · UTC 2026-12-01

Showing 47 of 47 types (188 members)

EricksonLopez.SharedKernel#

15
class

AggregateRoot<TId>

Assembly: EricksonLopez.SharedKernel
public abstract class AggregateRoot<TId> : Entity<TId>, IAggregateRoot where TId : notnull, IEquatable<TId>
Inherits: Entity<TId>Implements: IAggregateRoot

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

Remarks:

Aggregate roots encapsulate domain invariants and maintain an internal list of recorded domain events that are dispatched atomically via `DrainDomainEvents`. Note on Concurrency & Thread-Safety: Aggregate roots represent a single-threaded transactional consistency boundary and are designed to be processed by a single logical thread at a time within a unit of work. Mutating operations (`RaiseDomainEvent`, `ClearDomainEvents`, `RequeueDomainEvents`) are explicitly not thread-safe. `DrainDomainEvents` provides atomic buffer detachment via `Interlocked.Exchange<T>(ref T, T)` solely to guarantee single-consumer detachment if downstream interceptors or dispatchers attempt concurrent draining. Type parameters: TId: The strongly-typed identifier type of the aggregate root.

Members (5)

  • methodClearDomainEvents
    public void ClearDomainEvents()

    Clears all pending domain events recorded by this aggregate root.

  • methodDrainDomainEvents
    public IReadOnlyList<IDomainEvent> DrainDomainEvents()

    Transfers and clears all pending domain events recorded by this aggregate root.

    Returns: A read-only collection of pending domain events in emission order, or an empty collection if no events were recorded.

    Detaches the internal event collection and resets the buffer, ensuring domain events are dispatched only once.

  • methodRequeueDomainEvents
    public void RequeueDomainEvents(IEnumerable<IDomainEvent> events)

    Re-queues previously drained domain events back into this aggregate root, typically used during transactional rollback.

    events: IEnumerable<IDomainEvent>
    The domain events to restore.

    Exceptions: ArgumentNullException: `events` is `null`; ArgumentException: `events` contains one or more `null` elements

  • propertyDomainEvents
    public IReadOnlyList<IDomainEvent> DomainEvents { get; }

    Gets a read-only view of pending domain events recorded by this aggregate root without clearing them. Returns an immutable snapshot list to prevent concurrent modification exceptions during enumeration.

  • propertyPendingDomainEventsCount
    public int PendingDomainEventsCount { get; }

    Gets the count of pending domain events recorded by this aggregate root without allocating a snapshot list.

class

AuditableAggregateRoot<TId>

Assembly: EricksonLopez.SharedKernel
public abstract class AuditableAggregateRoot<TId> : AggregateRoot<TId>, IAuditableEntity where TId : notnull, IEquatable<TId>
Inherits: AggregateRoot<TId>Implements: IAuditableEntity

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

Remarks:

Type parameters: TId: The strongly-typed identifier type of the aggregate root.

Members (16)

  • methodMarkAsDeleted
    public void MarkAsDeleted(Guid deletedBy, DateTimeOffset deletedAt)

    Marks the aggregate root as soft-deleted with a GUID actor identifier and timestamp.

    deletedBy: Guid
    The deleter user GUID.
    deletedAt: DateTimeOffset
    The deletion timestamp.
  • methodMarkAsDeleted
    public void MarkAsDeleted(string? deletedBy, DateTimeOffset deletedAt)

    Marks the aggregate root as soft-deleted with the specified actor and timestamp.

    deletedBy: string?
    The deleter identifier.
    deletedAt: DateTimeOffset
    The deletion timestamp.
  • methodMarkAsUpdated
    public void MarkAsUpdated(Guid updatedBy, DateTimeOffset updatedAt)

    Marks the aggregate root as updated with a GUID actor identifier and timestamp.

    updatedBy: Guid
    The modifier user GUID.
    updatedAt: DateTimeOffset
    The modification timestamp.
  • methodMarkAsUpdated
    public void MarkAsUpdated(string? updatedBy, DateTimeOffset updatedAt)

    Marks the aggregate root as updated with the specified actor and timestamp.

    updatedBy: string?
    The modifier identifier.
    updatedAt: DateTimeOffset
    The modification timestamp.
  • methodSetCreated
    public void SetCreated(DateTimeOffset createdAt, string? createdBy = null)

    Sets the creation audit metadata for this aggregate root.

    createdAt: DateTimeOffset
    The timestamp when the aggregate root was created.
    createdBy: string?
    The optional user or system identifier that created the aggregate root.
  • methodSetDeleted
    public void SetDeleted(DateTimeOffset deletedAt, string? deletedBy = null)

    Sets the soft-deletion audit metadata for this aggregate root.

    deletedAt: DateTimeOffset
    The timestamp when the aggregate root was deleted.
    deletedBy: string?
    The optional user or system identifier that deleted the aggregate root.
  • methodSetModified
    public void SetModified(DateTimeOffset lastModifiedAt, string? lastModifiedBy = null)

    Sets the modification audit metadata for this aggregate root.

    lastModifiedAt: DateTimeOffset
    The timestamp when the aggregate root was modified.
    lastModifiedBy: string?
    The optional user or system identifier that modified the aggregate root.
  • propertyCreatedAt
    public DateTimeOffset CreatedAt { get; protected set; }

    Gets the date and time when the entity was created.

  • propertyCreatedBy
    public string? CreatedBy { get; protected set; }

    Gets the optional actor or user identifier that created the entity.

  • propertyDeletedAt
    public DateTimeOffset? DeletedAt { get; protected set; }

    Gets the date and time when the aggregate root was soft-deleted, if applicable.

  • propertyDeletedBy
    public string? DeletedBy { get; protected set; }

    Gets the optional actor or user identifier that soft-deleted the aggregate root, if applicable.

  • propertyIsDeleted
    public bool IsDeleted { get; }

    Gets a value indicating whether the aggregate root has been soft-deleted.

  • propertyLastModifiedAt
    public DateTimeOffset? LastModifiedAt { get; protected set; }

    Gets the date and time when the entity was last modified, if any.

  • propertyLastModifiedBy
    public string? LastModifiedBy { get; protected set; }

    Gets the optional actor or user identifier that last modified the entity, if any.

  • propertyUpdatedAt
    public DateTimeOffset? UpdatedAt { get; }

    Gets the date and time when the aggregate root was last modified (alias for `LastModifiedAt`).

  • propertyUpdatedBy
    public string? UpdatedBy { get; }

    Gets the optional actor or user identifier that last modified the aggregate root (alias for `LastModifiedBy`).

class

AuditableEntity<TId>

Assembly: EricksonLopez.SharedKernel
public abstract class AuditableEntity<TId> : Entity<TId>, IAuditableEntity where TId : notnull, IEquatable<TId>
Inherits: Entity<TId>Implements: IAuditableEntity

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

Remarks:

Type parameters: TId: The strongly-typed identifier type of the entity.

Members (16)

  • methodMarkAsDeleted
    public void MarkAsDeleted(Guid deletedBy, DateTimeOffset deletedAt)

    Marks the entity as soft-deleted with a GUID actor identifier and timestamp.

    deletedBy: Guid
    The deleter user GUID.
    deletedAt: DateTimeOffset
    The deletion timestamp.
  • methodMarkAsDeleted
    public void MarkAsDeleted(string? deletedBy, DateTimeOffset deletedAt)

    Marks the entity as soft-deleted with the specified actor and timestamp.

    deletedBy: string?
    The deleter identifier.
    deletedAt: DateTimeOffset
    The deletion timestamp.
  • methodMarkAsUpdated
    public void MarkAsUpdated(Guid updatedBy, DateTimeOffset updatedAt)

    Marks the entity as updated with a GUID actor identifier and timestamp.

    updatedBy: Guid
    The modifier user GUID.
    updatedAt: DateTimeOffset
    The modification timestamp.
  • methodMarkAsUpdated
    public void MarkAsUpdated(string? updatedBy, DateTimeOffset updatedAt)

    Marks the entity as updated with the specified actor and timestamp.

    updatedBy: string?
    The modifier identifier.
    updatedAt: DateTimeOffset
    The modification timestamp.
  • methodSetCreated
    public void SetCreated(DateTimeOffset createdAt, string? createdBy = null)

    Sets the creation audit metadata for this entity.

    createdAt: DateTimeOffset
    The timestamp when the entity was created.
    createdBy: string?
    The optional user or system identifier that created the entity.
  • methodSetDeleted
    public void SetDeleted(DateTimeOffset deletedAt, string? deletedBy = null)

    Sets the soft-deletion audit metadata for this entity.

    deletedAt: DateTimeOffset
    The timestamp when the entity was deleted.
    deletedBy: string?
    The optional user or system identifier that deleted the entity.
  • methodSetModified
    public void SetModified(DateTimeOffset lastModifiedAt, string? lastModifiedBy = null)

    Sets the modification audit metadata for this entity.

    lastModifiedAt: DateTimeOffset
    The timestamp when the entity was modified.
    lastModifiedBy: string?
    The optional user or system identifier that modified the entity.
  • propertyCreatedAt
    public DateTimeOffset CreatedAt { get; protected set; }

    Gets the date and time when the entity was created.

  • propertyCreatedBy
    public string? CreatedBy { get; protected set; }

    Gets the optional actor or user identifier that created the entity.

  • propertyDeletedAt
    public DateTimeOffset? DeletedAt { get; protected set; }

    Gets the date and time when the entity was soft-deleted, if applicable.

  • propertyDeletedBy
    public string? DeletedBy { get; protected set; }

    Gets the optional actor or user identifier that soft-deleted the entity, if applicable.

  • propertyIsDeleted
    public bool IsDeleted { get; }

    Gets a value indicating whether the entity has been soft-deleted.

  • propertyLastModifiedAt
    public DateTimeOffset? LastModifiedAt { get; protected set; }

    Gets the date and time when the entity was last modified, if any.

  • propertyLastModifiedBy
    public string? LastModifiedBy { get; protected set; }

    Gets the optional actor or user identifier that last modified the entity, if any.

  • propertyUpdatedAt
    public DateTimeOffset? UpdatedAt { get; }

    Gets the date and time when the entity was last modified (alias for `LastModifiedAt`).

  • propertyUpdatedBy
    public string? UpdatedBy { get; }

    Gets the optional actor or user identifier that last modified the entity (alias for `LastModifiedBy`).

record

DomainEvent

Assembly: EricksonLopez.SharedKernel
public abstract record DomainEvent : IDomainEvent
Implements: IDomainEvent

Represents an abstract base record for immutable domain events.

Remarks:

Instances are immutable and assigned a time-ordered UUIDv7 identifier (`EventId`) upon creation.

Members (4)

  • propertyEventId
    public Guid EventId { get; }

    Gets the underlying GUID value of the domain event identifier.

  • propertyId
    public EventId Id { get; }

    Gets the unique, time-ordered identifier of the domain event.

  • propertyOccurredAt
    public DateTimeOffset OccurredAt { get; }

    Gets the UTC timestamp at which the domain event occurred.

  • propertyOccurredOn
    public DateTimeOffset OccurredOn { get; }

    Gets the UTC occurrence timestamp as an alias for `OccurredAt`.

class

DomainEventIdentityEqualityComparer

Assembly: EricksonLopez.SharedKernel
public sealed class DomainEventIdentityEqualityComparer : IEqualityComparer<IDomainEvent>, IEqualityComparer<DomainEvent>
Implements: IEqualityComparer<DomainEvent>, IEqualityComparer<IDomainEvent>

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

Members (5)

  • methodEquals
    public bool Equals(DomainEvent? x, DomainEvent? y)

    Inherits documentation from base type or interface.

    x: DomainEvent?
    y: DomainEvent?
  • methodEquals
    public bool Equals(IDomainEvent? x, IDomainEvent? y)

    Inherits documentation from base type or interface.

    x: IDomainEvent?
    y: IDomainEvent?
  • methodGetHashCode
    public int GetHashCode(DomainEvent obj)

    Inherits documentation from base type or interface.

    obj: DomainEvent
  • methodGetHashCode
    public int GetHashCode(IDomainEvent obj)

    Inherits documentation from base type or interface.

    obj: IDomainEvent
  • propertyInstance
    public static DomainEventIdentityEqualityComparer Instance { get; }

    Gets the singleton instance of the `DomainEventIdentityEqualityComparer`.

class

Entity<TId>

Assembly: EricksonLopez.SharedKernel
public abstract class Entity<TId> : IEntity<TId>, IEquatable<Entity<TId>> where TId : notnull, IEquatable<TId>
Implements: IEntity<TId>, IEquatable<Entity<TId>>

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

Remarks:

Entities compare equality based on exact type matching and the equality of their `Id` property. Type parameters: TId: The strongly-typed identifier type of the entity.

Members (6)

  • methodEquals
    public virtual bool Equals(Entity<TId>? other)

    Inherits documentation from base type or interface.

    other: Entity<TId>?
  • methodEquals
    public override bool Equals(object? obj)

    Inherits documentation from base type or interface.

    obj: object?
  • methodGetHashCode
    public override int GetHashCode()

    Inherits documentation from base type or interface.

  • methodoperator !=
    public static bool operator !=(Entity<TId>? left, Entity<TId>? right)

    Determines whether two entity instances are not equal.

    left: Entity<TId>?
    The first entity to compare.
    right: Entity<TId>?
    The second entity to compare.

    Returns: `true` if the entities are not equal; otherwise, `false`.

  • methodoperator ==
    public static bool operator ==(Entity<TId>? left, Entity<TId>? right)

    Determines whether two entity instances are equal based on their runtime type and identity.

    left: Entity<TId>?
    The first entity to compare.
    right: Entity<TId>?
    The second entity to compare.

    Returns: `true` if both entities are equal; otherwise, `false`.

  • propertyId
    public TId Id { get; protected init; }

    Gets the unique identifier of the entity.

interface

IAggregateRoot

Assembly: EricksonLopez.SharedKernel
public interface IAggregateRoot : IHasDomainEvents
Implements: IHasDomainEvents

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

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

interface

IAuditableEntity

Assembly: EricksonLopez.SharedKernel
public interface IAuditableEntity

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

Members (4)

  • propertyCreatedAt
    DateTimeOffset CreatedAt { get; }

    Gets the date and time when the entity was created.

  • propertyCreatedBy
    string? CreatedBy { get; }

    Gets the optional actor or user identifier that created the entity.

  • propertyLastModifiedAt
    DateTimeOffset? LastModifiedAt { get; }

    Gets the date and time when the entity was last modified, if any.

  • propertyLastModifiedBy
    string? LastModifiedBy { get; }

    Gets the optional actor or user identifier that last modified the entity, if any.

interface

IDomainEventDispatcher

Assembly: EricksonLopez.SharedKernel
public interface IDomainEventDispatcher

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

Members (2)

  • methodDispatch
    void Dispatch(IReadOnlyList<IDomainEvent> domainEvents)

    Dispatches a collection of domain events in emission order synchronously.

    domainEvents: IReadOnlyList<IDomainEvent>
    The read-only collection of domain events to dispatch.

    Default implementation throws `NotSupportedException` to prevent sync-over-async threadpool starvation and deadlocks. Implementations requiring synchronous dispatch must provide a dedicated synchronous execution path.

  • methodDispatchAsync
    ValueTask DispatchAsync(IReadOnlyList<IDomainEvent> domainEvents, CancellationToken cancellationToken = default)

    Dispatches a collection of domain events in emission order asynchronously.

    domainEvents: IReadOnlyList<IDomainEvent>
    The read-only collection of domain events to dispatch.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation.

interface

IEntity

Assembly: EricksonLopez.SharedKernel
public interface IEntity

Defines a non-generic marker contract for domain entities.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

interface

IEntityId

Assembly: EricksonLopez.SharedKernel
public interface IEntityId

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

Members (3)

  • propertyIsDefault
    bool IsDefault { get; }

    Gets a value indicating whether the identifier equals the default uninitialized value (`Guid.Empty`).

  • propertyIsEmpty
    bool IsEmpty { get; }

    Gets a value indicating whether the identifier is empty (`Guid.Empty`).

  • propertyValue
    Guid Value { get; }

    Gets the underlying `Guid` value of the identifier.

interface

IEntityId<TSelf>

Assembly: EricksonLopez.SharedKernel
public interface IEntityId<TSelf> : IEntityId, IParsable<TSelf>, IEquatable<TSelf> where TSelf : struct, IEntityId<TSelf>
Implements: IEntityId, IEquatable<TSelf>, IParsable<TSelf>

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

Remarks:

Type parameters: TSelf: The strongly-typed identifier struct type.

Members (1)

  • methodCreate
    static abstract TSelf Create(Guid value)

    Creates an instance of `TSelf` wrapping the specified `value`.

    value: Guid
    The underlying `Guid` value.

    Returns: The strongly-typed identifier instance.

interface

IEntity<TId>

Assembly: EricksonLopez.SharedKernel
public interface IEntity<TId> : IEntity where TId : notnull, IEquatable<TId>
Implements: IEntity

Defines the contract for domain entities with a strongly-typed identifier.

Remarks:

Type parameters: TId: The strongly-typed identifier type of the entity.

Members (1)

  • propertyId
    TId Id { get; }

    Gets the unique identifier of the entity.

interface

IHasDomainEvents

Assembly: EricksonLopez.SharedKernel
public interface IHasDomainEvents

Defines the contract for domain objects capable of recording and releasing domain events.

Members (4)

  • methodClearDomainEvents
    void ClearDomainEvents()

    Clears all pending domain events recorded by this instance without returning them.

  • methodDrainDomainEvents
    IReadOnlyList<IDomainEvent> DrainDomainEvents()

    Transfers and clears all pending domain events recorded by this instance.

    Returns: A read-only collection of pending domain events in emission order, or an empty collection if no events were recorded.

  • methodRequeueDomainEvents
    void RequeueDomainEvents(IEnumerable<IDomainEvent> events)

    Re-queues previously drained domain events back into this instance, typically during transactional rollback.

    events: IEnumerable<IDomainEvent>
    The domain events to restore.

    Implementing types must explicitly handle restoring drained events. The default interface method throws `NotSupportedException` to prevent silent event loss during transactional rollback. Exceptions: NotSupportedException: The implementing type does not implement event restoration

  • propertyDomainEvents
    IReadOnlyList<IDomainEvent> DomainEvents { get; }

    Gets a read-only view of pending domain events recorded by this instance without clearing them.

class

OperationTimeContext

Assembly: EricksonLopez.SharedKernel
public static class OperationTimeContext

Provides an ambient per-operation timestamp so domain logic, auditing, and events can stay deterministic without threading a timestamp parameter through every entity method.

Members (4)

  • methodBeginScope
    public static IDisposable BeginScope(DateTimeOffset timestamp)

    Begins a new deterministic ambient operation time scope.

    timestamp: DateTimeOffset
    The frozen timestamp for the duration of this scope.

    Returns: An `IDisposable` scope that restores the previous timestamp upon disposal.

    Exceptions: ArgumentException: `timestamp` is equal to `default(DateTimeOffset)`

  • methodCurrentOrUtcNow
    public static DateTimeOffset CurrentOrUtcNow()

    Gets the current ambient operation timestamp if available, or returns `TimeProvider.System`'s current UTC timestamp.

    Returns: The deterministic operation timestamp in UTC.

  • methodReset
    public static void Reset()

    Resets the ambient operation time context for the current asynchronous execution context.

    ⚠️ FOR TEST USE ONLY. DO NOT CALL IN PRODUCTION CODE. This method is intended exclusively for test isolation — it clears the entire ambient stack for the current async execution context. Calling this in production code will corrupt ambient timestamp state for any concurrent operation that shares the same execution context tree, causing silent data integrity failures in domain events and auditing. Proper cleanup in production code must always be achieved by disposing the `IDisposable` scope returned by `BeginScope`.

  • propertyCurrent
    public static DateTimeOffset? Current { get; }

    Gets the current ambient operation timestamp if a scope is active; otherwise, `null`.

EricksonLopez.SharedKernel.Dapper#

7
class

DapperBclTypeHandlerRegistry

Assembly: EricksonLopez.SharedKernel.Dapper
public static class DapperBclTypeHandlerRegistry

Provides static registration methods for standard BCL Dapper TypeHandlers.

Members (1)

  • methodRegisterAll
    public static void RegisterAll()

    Registers all standard BCL type handlers (`DateOnly`, `DateTimeOffset`, `TimeOnly`) with Dapper.

    This method is fully AOT-safe and uses zero runtime reflection or dynamic code generation.

class

DapperStrongIdRegistry

Assembly: EricksonLopez.SharedKernel.Dapper
public static class DapperStrongIdRegistry

Provides methods to register Dapper type handlers for strongly-typed domain identifiers.

Remarks:

Registration should occur once during application startup or composition root configuration.

Members (4)

  • methodRegister<TSelf, TValue>
    public static void Register<TSelf, TValue>() where TSelf : notnull, IStrongId<TSelf, TValue> where TValue : notnull, IEquatable<TValue>

    Registers a Dapper type handler for the specified strongly-typed identifier.

    This method is fully compatible with Native AOT and trimming. Type parameters: TSelf: The strongly-typed identifier type.; TValue: The underlying primitive value type.

  • methodRegisterByConvention
    public static void RegisterByConvention(Assembly assembly, Func<Type, bool>? filter = null)

    Scans an assembly and registers Dapper type handlers for all types matching convention or a specified filter.

    assembly: Assembly
    The assembly to scan for strongly-typed identifier types.
    filter: Func<Type, bool>?
    An optional predicate to filter eligible types.

    Native AOT / Trimming Incompatible: This method relies on reflection and runtime dynamic invocation. For Native AOT environments, use explicit registration via `Register<TSelf, TValue>` or source generation. Exceptions: ArgumentNullException: `assembly` is `null`

  • methodRegisterFromAssemblies
    public static void RegisterFromAssemblies(params Assembly[] assemblies)

    Scans multiple assemblies and registers Dapper type handlers for all concrete types implementing `IStrongId<TSelf, TValue>`.

    assemblies: params Assembly[]
    An array of assemblies to scan for strongly-typed identifier types.

    This method uses reflection and dynamic code generation and is incompatible with Native AOT and Trimming. Exceptions: ArgumentNullException: `assemblies` is `null`

  • methodRegisterFromAssembly
    public static void RegisterFromAssembly(Assembly assembly)

    Scans an assembly and registers Dapper type handlers for all concrete types implementing `IStrongId<TSelf, TValue>`.

    assembly: Assembly
    The assembly to scan for strongly-typed identifier types.

    Native AOT / Trimming Incompatible. This method uses reflection-based assembly scanning (`Assembly.GetTypes`) and constructs generic `StrongIdTypeHandler<TSelf, TValue>` instances via `Activator.CreateInstance` at runtime. Both operations are incompatible with Native AOT (`IL3050`) and Trimming (`IL2026`). AOT-safe alternative: Register each strongly-typed identifier explicitly using `Register<TSelf, TValue>()` during application startup:

    DapperStrongIdRegistry.Register<OrderId, Guid>();
    DapperStrongIdRegistry.Register<CustomerId, Guid>();

    Use this overload only in non-AOT, non-trimmed environments (e.g., traditional ASP.NET Core without `PublishAot=true` or `PublishTrimmed=true`) and only during application composition startup, never in hot paths. Exceptions: ArgumentNullException: `assembly` is `null`

class

DateOnlyTypeHandler

Assembly: EricksonLopez.SharedKernel.Dapper
public sealed class DateOnlyTypeHandler : SqlMapper.TypeHandler<DateOnly>
Inherits: SqlMapper.TypeHandler<DateOnly>

Dapper type handler for mapping `DateOnly` to and from database parameters and values.

Members (2)

  • methodParse
    public override DateOnly Parse(object value)

    Inherits documentation from base type or interface.

    value: object
  • methodSetValue
    public override void SetValue(IDbDataParameter parameter, DateOnly value)

    Inherits documentation from base type or interface.

    parameter: IDbDataParameter
    value: DateOnly
class

DateTimeOffsetTypeHandler

Assembly: EricksonLopez.SharedKernel.Dapper
public sealed class DateTimeOffsetTypeHandler : SqlMapper.TypeHandler<DateTimeOffset>
Inherits: SqlMapper.TypeHandler<DateTimeOffset>

Dapper type handler for mapping `DateTimeOffset` to and from database parameters and values with strict UTC normalization.

Members (2)

  • methodParse
    public override DateTimeOffset Parse(object value)

    Inherits documentation from base type or interface.

    value: object
  • methodSetValue
    public override void SetValue(IDbDataParameter parameter, DateTimeOffset value)

    Inherits documentation from base type or interface.

    parameter: IDbDataParameter
    value: DateTimeOffset
class

EntityIdTypeHandler<TId>

Assembly: EricksonLopez.SharedKernel.Dapper
public sealed class EntityIdTypeHandler<TId> : SqlMapper.TypeHandler<TId> where TId : struct, IEntityId<TId>
Inherits: SqlMapper.TypeHandler<TId>

Zero-reflection Dapper `SqlMapper.TypeHandler<T>` for strongly-typed identifiers implementing `IEntityId<TSelf>`.

Remarks:

Type parameters: TId: The strongly-typed identifier struct type.

Members (2)

  • methodParse
    public override TId Parse(object value)

    Inherits documentation from base type or interface.

    value: object
  • methodSetValue
    public override void SetValue(IDbDataParameter parameter, TId value)

    Inherits documentation from base type or interface.

    parameter: IDbDataParameter
    value: TId
class

StrongIdTypeHandler<TSelf, TValue>

Assembly: EricksonLopez.SharedKernel.Dapper
public sealed class StrongIdTypeHandler<TSelf, TValue> : SqlMapper.TypeHandler<TSelf> where TSelf : notnull, IStrongId<TSelf, TValue> where TValue : notnull, IEquatable<TValue>
Inherits: SqlMapper.TypeHandler<TSelf>

Represents a Dapper type handler for mapping strongly-typed domain identifiers to and from database parameters.

Remarks:

Type parameters: TSelf: The strongly-typed identifier type.; TValue: The underlying database primitive value type.

Members (2)

  • methodParse
    public override TSelf Parse(object value)

    Converts a raw database value to a `TSelf` strongly-typed identifier.

    value: object
    The raw database value to convert.

    Returns: A `TSelf` instance constructed from the database value.

    Exceptions: Data.DataException: `value` is `null` or `DBNull`, `value` is not assignable to `TValue`, or the primitive value is not valid for `TSelf`

  • methodSetValue
    public override void SetValue(IDbDataParameter parameter, TSelf? value)

    Sets the database parameter value from the specified strongly-typed identifier.

    parameter: IDbDataParameter
    The database parameter to configure.
    value: TSelf?
    The strongly-typed identifier whose underlying value is applied to the parameter. When `null` or when the underlying value is `null`, sets the parameter value to `DBNull.Value`.

    Exceptions: ArgumentNullException: `parameter` is `null`

class

TimeOnlyTypeHandler

Assembly: EricksonLopez.SharedKernel.Dapper
public sealed class TimeOnlyTypeHandler : SqlMapper.TypeHandler<TimeOnly>
Inherits: SqlMapper.TypeHandler<TimeOnly>

Dapper type handler for mapping `TimeOnly` to and from database parameters and values.

Members (2)

  • methodParse
    public override TimeOnly Parse(object value)

    Inherits documentation from base type or interface.

    value: object
  • methodSetValue
    public override void SetValue(IDbDataParameter parameter, TimeOnly value)

    Inherits documentation from base type or interface.

    parameter: IDbDataParameter
    value: TimeOnly

EricksonLopez.SharedKernel.EntityFrameworkCore#

5
enum

DomainEventDispatchTiming

Assembly: EricksonLopez.SharedKernel.EntityFrameworkCore
public enum DomainEventDispatchTiming

Defines the execution timing for domain event dispatching relative to database transaction commit in Entity Framework Core.

Members (2)

  • fieldAfterCommit
    AfterCommit = 0

    Dispatches domain events after the database transaction has committed (`DbContext.SaveChanges()`).

  • fieldBeforeCommit
    BeforeCommit = 1

    Dispatches domain events before the database transaction commits (`DbContext.SaveChanges()`), allowing transaction rollback if event dispatching fails.

    CAUTION: If EF Core retry execution strategies (e.g. `EnableRetryOnFailure`) are enabled, drained events restored during transient transaction failure will be re-dispatched on subsequent retry attempts. External integration event publishing should use the Transactional Outbox pattern or `AfterCommit` timing instead.

class

DomainEventsInterceptor

Assembly: EricksonLopez.SharedKernel.EntityFrameworkCore
public sealed class DomainEventsInterceptor : SaveChangesInterceptor
Inherits: SaveChangesInterceptor

Represents an Entity Framework Core `SaveChangesInterceptor` that collects and dispatches domain events from tracked `IHasDomainEvents` aggregate roots and entities before saving changes, clearing event buffers only after the database transaction successfully commits.

Members (12)

  • constructorDomainEventsInterceptor
    public DomainEventsInterceptor()

    Initializes a new instance of the `DomainEventsInterceptor` class without a dispatcher.

  • constructorDomainEventsInterceptor
    public DomainEventsInterceptor(IDomainEventDispatcher? dispatcher)

    Initializes a new instance of the `DomainEventsInterceptor` class with the optional domain event dispatcher.

    dispatcher: IDomainEventDispatcher?
    The optional domain event dispatcher used to dispatch drained events.
  • constructorDomainEventsInterceptor
    public DomainEventsInterceptor(IDomainEventDispatcher? dispatcher, DomainEventDispatchTiming timing, Action<Exception, IReadOnlyList<IDomainEvent>>? onDispatchError = null)

    Initializes a new instance of the `DomainEventsInterceptor` class with the domain event dispatcher, dispatch timing, and error handling callback.

    dispatcher: IDomainEventDispatcher?
    The optional domain event dispatcher used to dispatch drained events.
    timing: DomainEventDispatchTiming
    The dispatch timing relative to the database commit.
    onDispatchError: Action<Exception, IReadOnlyList<IDomainEvent>>?
    Optional callback invoked when dispatching fails in post-commit mode.
  • methodClearEvents
    public static void ClearEvents(DbContext context)

    Clears all pending domain events from tracked entities within the specified database context.

    context: DbContext
    The database context containing tracked entities.

    Exceptions: ArgumentNullException: `context` is `null`

  • methodCollectAndDrainEvents
    public static IReadOnlyList<IDomainEvent> CollectAndDrainEvents(DbContext context)

    Collects and drains all pending domain events from tracked entities within the specified database context.

    context: DbContext
    The database context containing tracked entities.

    Returns: A read-only collection of all drained domain events in emission order, or an empty collection if no events were recorded.

    Exceptions: ArgumentNullException: `context` is `null`

  • methodCollectEvents
    public static IReadOnlyList<IDomainEvent> CollectEvents(DbContext context)

    Collects all pending domain events from tracked entities within the specified database context without clearing them.

    context: DbContext
    The database context containing tracked entities.

    Returns: A read-only collection of all pending domain events in emission order, or an empty collection if no events were recorded.

    Exceptions: ArgumentNullException: `context` is `null`

  • methodSaveChangesFailed
    public override void SaveChangesFailed(DbContextErrorEventData eventData)

    Inherits documentation from base type or interface.

    eventData: DbContextErrorEventData
  • methodSaveChangesFailedAsync
    public override Task SaveChangesFailedAsync(DbContextErrorEventData eventData, CancellationToken cancellationToken = default)

    Inherits documentation from base type or interface.

    eventData: DbContextErrorEventData
    cancellationToken: CancellationToken
  • methodSavedChanges
    public override int SavedChanges(SaveChangesCompletedEventData eventData, int result)

    Inherits documentation from base type or interface.

    eventData: SaveChangesCompletedEventData
    result: int
  • methodSavedChangesAsync
    public override async ValueTask<int> SavedChangesAsync(SaveChangesCompletedEventData eventData, int result, CancellationToken cancellationToken = default)

    Inherits documentation from base type or interface.

    eventData: SaveChangesCompletedEventData
    result: int
    cancellationToken: CancellationToken
  • methodSavingChanges
    public override InterceptionResult<int> SavingChanges(DbContextEventData eventData, InterceptionResult<int> result)

    Intercepts synchronous `DbContext.SaveChanges()` calls to collect pending domain events from tracked entities. In `DomainEventDispatchTiming.BeforeCommit` mode, events are dispatched immediately before saving. In `DomainEventDispatchTiming.AfterCommit` mode, dispatching is deferred to `SavedChanges`.

    eventData: DbContextEventData
    The contextual information for the SaveChanges operation.
    result: InterceptionResult<int>
    The current interception result.

    Returns: The interception result value.

    Exceptions: ArgumentNullException: `eventData` is `null`

  • methodSavingChangesAsync
    public override async ValueTask<InterceptionResult<int>> SavingChangesAsync(DbContextEventData eventData, InterceptionResult<int> result, CancellationToken cancellationToken = default)

    Intercepts asynchronous `DbContext.SaveChangesAsync(CancellationToken)` calls to collect pending domain events from tracked entities. In `DomainEventDispatchTiming.BeforeCommit` mode, events are dispatched immediately before saving. In `DomainEventDispatchTiming.AfterCommit` mode, dispatching is deferred to `SavedChangesAsync`.

    eventData: DbContextEventData
    The contextual information for the SaveChanges operation.
    result: InterceptionResult<int>
    The current interception result.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the interception result.

    Exceptions: ArgumentNullException: `eventData` is `null`

class

EntityEqualityComparer

Assembly: EricksonLopez.SharedKernel.EntityFrameworkCore
public static class EntityEqualityComparer

Provides factory methods and proxy unwrapping helpers for entity equality comparison in Entity Framework Core.

Members (2)

  • methodCreate<TId>
    public static EntityEqualityComparer<TId> Create<TId>() where TId : notnull, IEquatable<TId>

    Creates a proxy-aware equality comparer for the specified strongly-typed entity identifier.

    Returns: A new `EntityEqualityComparer<TId>` instance.

    Type parameters: TId: The strongly-typed identifier type.

  • methodGetUnproxiedType
    public static Type GetUnproxiedType(Type type)

    Unwraps dynamic proxy types (such as Castle DynamicProxy or EF Core lazy-loading proxies) to their base entity type.

    type: Type
    The runtime type of the entity or proxy instance.

    Returns: The underlying domain entity type.

    Exceptions: ArgumentNullException: `type` is `null`

class

EntityEqualityComparer<TId>

Assembly: EricksonLopez.SharedKernel.EntityFrameworkCore
public sealed class EntityEqualityComparer<TId> : IEqualityComparer<Entity<TId>> where TId : notnull, IEquatable<TId>
Implements: IEqualityComparer<Entity<TId>>

Provides proxy-aware equality comparison for `Entity<TId>` instances in Entity Framework Core, unwrapping dynamic proxies (such as Castle or EF Core change-tracking proxies) to their underlying domain entity types.

Remarks:

Per ADR-015, proxy-transparent equality belongs strictly to the Infrastructure layer to preserve domain purity and prevent ORM coupling in the Tier 0 SharedKernel domain primitives. Type parameters: TId: The strongly-typed identifier type.

Members (3)

  • constructorEntityEqualityComparer
    public EntityEqualityComparer()

    Initializes a new instance of the `EntityEqualityComparer<TId>` class.

  • methodEquals
    public bool Equals(Entity<TId>? x, Entity<TId>? y)

    Inherits documentation from base type or interface.

    x: Entity<TId>?
    y: Entity<TId>?
  • methodGetHashCode
    public int GetHashCode(Entity<TId> obj)

    Inherits documentation from base type or interface.

    obj: Entity<TId>
class

StrongIdValueConverter<TId, TValue>

Assembly: EricksonLopez.SharedKernel.EntityFrameworkCore
public class StrongIdValueConverter<TId, TValue> : ValueConverter<TId, TValue> where TId : notnull, IStrongId<TId, TValue> where TValue : notnull, IEquatable<TValue>
Inherits: ValueConverter<TId, TValue>

Represents an Entity Framework Core value converter for strongly-typed domain identifiers implementing `IStrongId<TSelf, TValue>`.

Remarks:

Type parameters: TId: The strongly-typed identifier type.; TValue: The underlying primitive value type.

Members (3)

  • constructorStrongIdValueConverter
    public StrongIdValueConverter()

    Initializes a new instance of the `StrongIdValueConverter<TId, TValue>` class using the default factory and no mapping hints.

  • constructorStrongIdValueConverter
    public StrongIdValueConverter(ConverterMappingHints? mappingHints)

    Initializes a new instance of the `StrongIdValueConverter<TId, TValue>` class using the static factory method `IStrongId<TSelf, TValue>.Create` and optional mapping hints.

    mappingHints: ConverterMappingHints?
    The optional converter mapping hints.
  • constructorStrongIdValueConverter
    public StrongIdValueConverter(Func<TValue, TId> factory, ConverterMappingHints? mappingHints = null)

    Initializes a new instance of the `StrongIdValueConverter<TId, TValue>` class using the specified factory delegate and optional mapping hints.

    factory: Func<TValue, TId>
    The factory delegate used to construct an instance of `TId` from its underlying `TValue`.
    mappingHints: ConverterMappingHints?
    The optional converter mapping hints.

    Exceptions: ArgumentNullException: `factory` is `null`

EricksonLopez.SharedKernel.Json#

3
class

SharedKernelJsonModifiers

Assembly: EricksonLopez.SharedKernel.Json
public static class SharedKernelJsonModifiers

Provides JSON contract resolver and type info modifiers for EricksonLopez.SharedKernel domain types.

Members (1)

  • methodIgnoreLegacyDomainEventAliases
    public static void IgnoreLegacyDomainEventAliases(JsonTypeInfo typeInfo)

    TypeInfo modifier that strips redundant backward-compatibility legacy alias properties (`EventId` and `OccurredOn`) from `DomainEvent` JSON payloads, reducing wire weight by up to 35%.

    typeInfo: JsonTypeInfo
    The JSON type info descriptor to modify.

    Exceptions: ArgumentNullException: `typeInfo` is `null`

class

StrongIdJsonConverterFactory

Assembly: EricksonLopez.SharedKernel.Json
public sealed class StrongIdJsonConverterFactory : JsonConverterFactory
Inherits: JsonConverterFactory

Provides a JSON converter factory that creates converter instances for types implementing `IStrongId<TSelf, TValue>`.

Members (2)

  • methodCanConvert
    public override bool CanConvert(Type typeToConvert)

    Determines whether this factory can produce a converter for the specified type.

    typeToConvert: Type
    The type to evaluate for converter support.

    Returns: `true` if `typeToConvert` implements `IStrongId<TSelf, TValue>`; otherwise, `false`.

    Exceptions: ArgumentNullException: `typeToConvert` is `null`

  • methodCreateConverter
    public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)

    Creates a `StrongIdJsonConverter<TSelf, TValue>` for the specified strongly-typed identifier type.

    typeToConvert: Type
    The strongly-typed identifier type for which to create a converter.
    options: JsonSerializerOptions
    The serializer options passed to the created converter.

    Returns: A `JsonConverter` for `typeToConvert`.

    Converter instances are cached per type; repeated calls for the same `typeToConvert` return the same converter. Exceptions: ArgumentNullException: `typeToConvert` or `options` is `null`; InvalidOperationException: `typeToConvert` does not implement `IStrongId<TSelf, TValue>`

class

StrongIdJsonConverter<TSelf, TValue>

Assembly: EricksonLopez.SharedKernel.Json
public sealed class StrongIdJsonConverter<TSelf, TValue> : JsonConverter<TSelf> where TSelf : notnull, IStrongId<TSelf, TValue> where TValue : notnull, IEquatable<TValue>
Inherits: JsonConverter<TSelf>

Represents a JSON converter for strongly-typed domain identifiers that serializes and deserializes values using their underlying primitive type.

Remarks:

Type parameters: TSelf: The strongly-typed identifier type.; TValue: The underlying primitive value type.

Members (2)

  • methodRead
    public override TSelf Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

    Reads and converts a JSON value to a `TSelf` instance using the underlying primitive type `TValue`.

    reader: ref Utf8JsonReader
    The reader to read the JSON value from.
    typeToConvert: Type
    The target type to convert to.
    options: JsonSerializerOptions
    The serializer options to use during deserialization.

    Returns: The deserialized `TSelf` instance.

    Exceptions: Json.JsonException: The JSON token is `null`, the underlying primitive is `null`, or the primitive value is not valid for `TSelf`

  • methodWrite
    public override void Write(Utf8JsonWriter writer, TSelf value, JsonSerializerOptions options)

    Writes a `TSelf` value as its underlying `TValue` primitive to the JSON writer.

    writer: Utf8JsonWriter
    The writer to write the JSON value to.
    value: TSelf
    The strongly-typed identifier value to serialize.
    options: JsonSerializerOptions
    The serializer options to use during serialization.

    Exceptions: ArgumentNullException: `writer` is `null`

EricksonLopez.SharedKernel.OpenTelemetry#

3
class

OpenTelemetryDomainEventDispatcher

Assembly: EricksonLopez.SharedKernel.OpenTelemetry
public sealed class OpenTelemetryDomainEventDispatcher : IDomainEventDispatcher
Implements: IDomainEventDispatcher

Decorates an `IDomainEventDispatcher` with OpenTelemetry distributed tracing spans and metrics collection.

Members (4)

  • constructorOpenTelemetryDomainEventDispatcher
    public OpenTelemetryDomainEventDispatcher(IDomainEventDispatcher inner)

    Initializes a new instance of the `OpenTelemetryDomainEventDispatcher` class wrapping the specified dispatcher.

    inner: IDomainEventDispatcher
    The underlying domain event dispatcher to wrap.

    Exceptions: ArgumentNullException: `inner` is `null`

  • constructorOpenTelemetryDomainEventDispatcher
    public OpenTelemetryDomainEventDispatcher(IDomainEventDispatcher inner, ActivitySource? activitySource = null, Meter? meter = null)

    Initializes a new instance of the `OpenTelemetryDomainEventDispatcher` class with optional custom activity source and meter.

    inner: IDomainEventDispatcher
    The underlying domain event dispatcher to wrap.
    activitySource: ActivitySource?
    Optional custom activity source; falls back to `SharedKernelInstrumentation.ActivitySource` if `null`.
    meter: Meter?
    Optional custom meter; falls back to `SharedKernelInstrumentation.Meter` if `null`.

    Exceptions: ArgumentNullException: `inner` is `null`

  • methodDispatch
    public void Dispatch(IReadOnlyList<IDomainEvent> domainEvents)

    Dispatches a collection of domain events in emission order synchronously.

    domainEvents: IReadOnlyList<IDomainEvent>
    The read-only collection of domain events to dispatch.

    Default implementation throws `NotSupportedException` to prevent sync-over-async threadpool starvation and deadlocks. Implementations requiring synchronous dispatch must provide a dedicated synchronous execution path.

  • methodDispatchAsync
    public async ValueTask DispatchAsync(IReadOnlyList<IDomainEvent> domainEvents, CancellationToken cancellationToken = default)

    Dispatches a collection of domain events in emission order asynchronously.

    domainEvents: IReadOnlyList<IDomainEvent>
    The read-only collection of domain events to dispatch.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation.

class

SharedKernelInstrumentation

Assembly: EricksonLopez.SharedKernel.OpenTelemetry
public static class SharedKernelInstrumentation

Provides OpenTelemetry diagnostic activity sources, meters, and metric instruments for domain event dispatching.

Members (8)

  • methodRecordDispatchDuration
    public static void RecordDispatchDuration(double durationMs, int batchSize, string? tenantId = null)

    Records the duration of a domain event dispatch batch in milliseconds with optional tenant context.

    durationMs: double
    The execution duration in milliseconds.
    batchSize: int
    The count of domain events in the batch.
    tenantId: string?
    The optional tenant identifier for multi-tenant isolation.
  • methodRecordDomainEventDispatched
    public static void RecordDomainEventDispatched(string eventType, string? tenantId = null)

    Records the dispatch of a domain event with optional tenant context and custom tags.

    eventType: string
    The CLR name or type of the domain event.
    tenantId: string?
    The optional tenant identifier for multi-tenant isolation.
  • fieldActivitySource
    public static readonly ActivitySource ActivitySource

    Specifies the `Diagnostics.ActivitySource` used to create OpenTelemetry spans during domain event dispatch.

  • fieldActivitySourceName
    public const string ActivitySourceName

    Specifies the name of the OpenTelemetry `Diagnostics.ActivitySource` and `Metrics.Meter`.

  • fieldDispatchDurationHistogram
    public static readonly Histogram<double> DispatchDurationHistogram

    Specifies the metric histogram tracking execution durations of domain event dispatch operations.

  • fieldDispatchedEventsCounter
    public static readonly Counter<long> DispatchedEventsCounter

    Specifies the metric counter tracking the total number of domain events dispatched.

  • fieldMeter
    public static readonly Meter Meter

    Specifies the `Metrics.Meter` used to record domain event metrics.

  • fieldVersion
    public const string Version

    Specifies the instrumentation library version.

class

SharedKernelInstrumentation.Attributes

Assembly: EricksonLopez.SharedKernel.OpenTelemetry
public static class Attributes

Defines OpenTelemetry semantic attribute keys for domain event spans and metrics.

Members (4)

  • fieldEventId
    public const string EventId

    Specifies the semantic attribute key for the unique domain event identifier.

  • fieldEventType
    public const string EventType

    Specifies the semantic attribute key for the domain event CLR type name.

  • fieldOccurredAt
    public const string OccurredAt

    Specifies the semantic attribute key for the UTC occurrence timestamp of the domain event.

  • fieldTenantId
    public const string TenantId

    Specifies the semantic attribute key for the tenant identifier in multi-tenant environments.

EricksonLopez.SharedKernel.Persistence#

7
class

AuditAttribute

Assembly: EricksonLopez.SharedKernel.Persistence
public sealed class AuditAttribute : Attribute
Inherits: Attribute

Marks a property as an audit field. The Unit of Work will automatically populate this field during inserts/updates.

Members (2)

  • constructorAuditAttribute
    public AuditAttribute(AuditFieldType fieldType)

    Initializes a new instance of the `AuditAttribute` class.

    fieldType: AuditFieldType
    The type of audit data represented by this property.
  • propertyFieldType
    public AuditFieldType FieldType { get; }

    Gets the audit data type represented by this property.

enum

AuditFieldType

Assembly: EricksonLopez.SharedKernel.Persistence
public enum AuditFieldType

Defines the type of audit data a property represents.

Members (5)

  • fieldCreatedAt
    CreatedAt

    Timestamp when the record was created.

  • fieldCreatedBy
    CreatedBy

    Identifier of the user or system that created the record.

  • fieldUpdatedAt
    UpdatedAt

    Timestamp when the record was last modified.

  • fieldUpdatedBy
    UpdatedBy

    Identifier of the user or system that last modified the record.

  • fieldVersion
    Version

    Concurrency row version or revision token.

class

ColumnAttribute

Assembly: EricksonLopez.SharedKernel.Persistence
public sealed class ColumnAttribute : Attribute
Inherits: Attribute

Specifies the database column that a property is mapped to.

Members (4)

  • constructorColumnAttribute
    public ColumnAttribute(string name)

    Initializes a new instance of the `ColumnAttribute` class with the specified column name.

    name: string
    The name of the database column.
  • propertyIsDatabaseGenerated
    public bool IsDatabaseGenerated { get; set; }

    Gets or sets whether this column's value is generated by the database (e.g., identity or default expression).

  • propertyIsPrimaryKey
    public bool IsPrimaryKey { get; set; }

    Gets or sets whether this column is part of the primary key.

  • propertyName
    public string Name { get; }

    Gets the name of the column.

record

EntityMetadata

Assembly: EricksonLopez.SharedKernel.Persistence
public sealed record EntityMetadata

Represents compile-time extracted schema and persistence metadata for a domain entity. Contains pre-computed column indices, primary keys, and specialized structural markers (tenant, audit, concurrency).

Members (10)

  • methodGetColumn
    public PropertyMetadata GetColumn(string clrName)

    Retrieves the property metadata for the given CLR property name.

    clrName: string
    The name of the CLR property.

    Returns: The associated `PropertyMetadata`.

    Exceptions: KeyNotFoundException: Thrown when no column matches the property name

  • methodTryGetColumn
    public bool TryGetColumn(string clrName, out PropertyMetadata? meta)

    Attempts to retrieve the property metadata for the given CLR property name.

    clrName: string
    The name of the CLR property.
    meta: out PropertyMetadata?
    When this method returns, contains the metadata if found; otherwise, null.

    Returns: True if the column metadata was found; otherwise, false.

  • propertyClrType
    public required Type ClrType { get; init; }

    Gets the CLR type of the domain entity.

  • propertyColumns
    public IReadOnlyList<PropertyMetadata> Columns { get; init; }

    Gets the complete list of mapped columns for this entity.

  • propertyConcurrencyToken
    public PropertyMetadata? ConcurrencyToken { get; init; }

    Gets the concurrency token column metadata, or null if optimistic concurrency is not configured.

  • propertyPrimaryKeys
    public IReadOnlyList<PropertyMetadata> PrimaryKeys { get; init; }

    Gets the list of primary key columns for this entity.

  • propertySchema
    public string Schema { get; init; }

    Gets the database schema name (defaults to "public").

  • propertySoftDeleteColumn
    public PropertyMetadata? SoftDeleteColumn { get; init; }

    Gets the soft delete column metadata, or null if soft deletion is not enabled.

  • propertyTableName
    public string TableName { get; init; }

    Gets the target database table name.

  • propertyTenantColumn
    public PropertyMetadata? TenantColumn { get; init; }

    Gets the tenant column metadata, or null if the entity is not tenant-scoped.

record

PropertyMetadata

Assembly: EricksonLopez.SharedKernel.Persistence
public sealed record PropertyMetadata(string ClrName, Type ClrType, string ColumnName, string DatabaseType, bool IsKey, bool IsNullable, bool IsAuditColumn, bool IsSoftDeleteColumn, bool IsTenantColumn, bool IsConcurrencyToken, Func<object, object?> Getter, Action<object, object?>? Setter)

Represents compile-time extracted metadata for a single property of a domain entity. Provides statically typed delegate accessors (Getter and Setter) to eliminate runtime reflection.

Members (17)

  • constructorPropertyMetadata
    public PropertyMetadata(string ClrName, Type ClrType, string ColumnName, string DatabaseType, bool IsKey, bool IsNullable, bool IsAuditColumn, bool IsSoftDeleteColumn, bool IsTenantColumn, bool IsConcurrencyToken, Func<object, object?> Getter, Action<object, object?>? Setter)

    Initializes a new instance of PropertyMetadata.

    ClrName: string
    The CLR name of the property.
    ClrType: Type
    The CLR type of the property.
    ColumnName: string
    The mapped database column name.
    DatabaseType: string
    The database data type descriptor.
    IsKey: bool
    True if this column is part of the primary key.
    IsNullable: bool
    True if this property accepts null values.
    IsAuditColumn: bool
    True if this property is decorated with an audit marker.
    IsSoftDeleteColumn: bool
    True if this property manages soft deletion state.
    IsTenantColumn: bool
    True if this property holds the tenant identifier.
    IsConcurrencyToken: bool
    True if this property acts as an optimistic concurrency token.
    Getter: Func<object, object?>
    Compiled delegate to retrieve the property value without reflection.
    Setter: Action<object, object?>?
    Compiled delegate to set the property value without reflection, or null if read-only.
  • methodGetValue<TEntity, TProperty>
    public TProperty GetValue<TEntity, TProperty>(TEntity entity)

    Retrieves the property value without boxing allocations when strongly-typed delegate is available.

    entity: TEntity
  • methodSetValue<TEntity, TProperty>
    public void SetValue<TEntity, TProperty>(TEntity entity, TProperty value)

    Assigns the property value without boxing allocations when strongly-typed delegate is available.

    entity: TEntity
    value: TProperty
  • propertyClrName
    public string ClrName { get; init; }

    The CLR name of the property.

  • propertyClrType
    public Type ClrType { get; init; }

    The CLR type of the property.

  • propertyColumnName
    public string ColumnName { get; init; }

    The mapped database column name.

  • propertyDatabaseType
    public string DatabaseType { get; init; }

    The database data type descriptor.

  • propertyGetter
    public Func<object, object?> Getter { get; init; }

    Compiled delegate to retrieve the property value without reflection.

  • propertyIsAuditColumn
    public bool IsAuditColumn { get; init; }

    True if this property is decorated with an audit marker.

  • propertyIsConcurrencyToken
    public bool IsConcurrencyToken { get; init; }

    True if this property acts as an optimistic concurrency token.

  • propertyIsKey
    public bool IsKey { get; init; }

    True if this column is part of the primary key.

  • propertyIsNullable
    public bool IsNullable { get; init; }

    True if this property accepts null values.

  • propertyIsSoftDeleteColumn
    public bool IsSoftDeleteColumn { get; init; }

    True if this property manages soft deletion state.

  • propertyIsTenantColumn
    public bool IsTenantColumn { get; init; }

    True if this property holds the tenant identifier.

  • propertySetter
    public Action<object, object?>? Setter { get; init; }

    Compiled delegate to set the property value without reflection, or null if read-only.

  • propertyStronglyTypedGetter
    public Delegate? StronglyTypedGetter { get; init; }

    Gets the optional strongly typed getter delegate (e.g. Func<TEntity, TProperty>).

  • propertyStronglyTypedSetter
    public Delegate? StronglyTypedSetter { get; init; }

    Gets the optional strongly typed setter delegate (e.g. Action<TEntity, TProperty>).

class

TableAttribute

Assembly: EricksonLopez.SharedKernel.Persistence
public sealed class TableAttribute : Attribute
Inherits: Attribute

Specifies the database table that a class is mapped to.

Members (3)

  • constructorTableAttribute
    public TableAttribute(string name)

    Initializes a new instance of the `TableAttribute` class with the specified table name.

    name: string
    The name of the database table.
  • propertyName
    public string Name { get; }

    Gets the name of the table.

  • propertySchema
    public string? Schema { get; set; }

    Gets or sets the schema of the table.

class

TenantScopedAttribute

Assembly: EricksonLopez.SharedKernel.Persistence
public sealed class TenantScopedAttribute : Attribute
Inherits: Attribute

Marks an entity as tenant-scoped. The infrastructure layer will automatically append tenant isolation rules (RLS) to queries for this entity.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

EricksonLopez.SharedKernel.SourceGenerators#

2
class

DapperRegistrationGenerator

Assembly: EricksonLopez.SharedKernel.SourceGenerators
public sealed class DapperRegistrationGenerator : IIncrementalGenerator
Implements: IIncrementalGenerator

Generates compile-time Dapper type handler registrations for strongly-typed identifiers to ensure Native AOT and trimming compatibility.

Members (1)

  • methodInitialize
    public void Initialize(IncrementalGeneratorInitializationContext context)

    Inherits documentation from base type or interface.

    context: IncrementalGeneratorInitializationContext
class

MetadataSourceGenerator

Assembly: EricksonLopez.SharedKernel.SourceGenerators
public sealed class MetadataSourceGenerator : IIncrementalGenerator
Implements: IIncrementalGenerator

Source generator that scans for domain entity hierarchies (AggregateRoot and Entity) and emits static zero-reflection metadata registrations with compiled PropertyMetadata accessors.

Members (1)

  • methodInitialize
    public void Initialize(IncrementalGeneratorInitializationContext context)

    Inherits documentation from base type or interface.

    context: IncrementalGeneratorInitializationContext

EricksonLopez.SharedKernel.Testing#

2
class

AggregateRootTestExtensions

Assembly: EricksonLopez.SharedKernel.Testing
public static class AggregateRootTestExtensions

Provides testing extension methods for asserting and collecting domain events from `AggregateRoot<TId>` instances.

Members (2)

  • methodCollectEvents
    public static DomainEventCollector CollectEvents(this IHasDomainEvents entityWithEvents)

    Drains all pending domain events from the entity or aggregate into a newly created `DomainEventCollector`.

    entityWithEvents: this IHasDomainEvents
    The entity or aggregate instance from which to collect events.

    Returns: A new `DomainEventCollector` populated with the drained events.

    Exceptions: ArgumentNullException: `entityWithEvents` is `null`

  • methodCollectEvents<TId>
    public static DomainEventCollector CollectEvents<TId>(this AggregateRoot<TId> aggregate) where TId : notnull, IEquatable<TId>

    Drains all pending domain events from the aggregate root into a newly created `DomainEventCollector`.

    aggregate: this AggregateRoot<TId>
    The aggregate root instance from which to collect events.

    Returns: A new `DomainEventCollector` populated with the drained events.

    Type parameters: TId: The aggregate identifier type. Exceptions: ArgumentNullException: `aggregate` is `null`

class

DomainEventCollector

Assembly: EricksonLopez.SharedKernel.Testing
public sealed class DomainEventCollector

Represents an in-memory test spy for capturing, querying, and asserting on domain events emitted by aggregate roots.

Members (6)

  • methodCollectFrom
    public DomainEventCollector CollectFrom(IHasDomainEvents entityWithEvents)

    Drains and records all pending domain events from the specified entity or aggregate.

    entityWithEvents: IHasDomainEvents
    The entity or aggregate from which to collect events.

    Returns: The current `DomainEventCollector` instance for method chaining.

    Exceptions: ArgumentNullException: `entityWithEvents` is `null`

  • methodCollectFrom<TId>
    public DomainEventCollector CollectFrom<TId>(AggregateRoot<TId> aggregate) where TId : notnull, IEquatable<TId>

    Drains and records all pending domain events from the specified aggregate root.

    aggregate: AggregateRoot<TId>
    The aggregate root from which to collect events.

    Returns: The current `DomainEventCollector` instance for method chaining.

    Type parameters: TId: The aggregate identifier type. Exceptions: ArgumentNullException: `aggregate` is `null`

  • methodExpectEvent<TEvent>
    public TEvent ExpectEvent<TEvent>(Func<TEvent, bool>? predicate = null) where TEvent : IDomainEvent

    Asserts that at least one domain event matching the specified type and optional predicate was collected.

    predicate: Func<TEvent, bool>?
    An optional predicate to filter matching domain events.

    Returns: The first matching domain event instance.

    Type parameters: TEvent: The expected domain event type. Exceptions: InvalidOperationException: No matching domain event was recorded

  • methodOfType<TEvent>
    public IEnumerable<TEvent> OfType<TEvent>() where TEvent : IDomainEvent

    Enumerates all collected domain events matching the specified event type.

    Returns: An enumerable collection of matching domain events.

    Type parameters: TEvent: The domain event type to filter.

  • methodReset
    public void Reset()

    Removes all previously collected domain events from this collector.

  • propertyCollectedEvents
    public IReadOnlyList<IDomainEvent> CollectedEvents { get; }

    Gets all domain events recorded by this collector in emission order as an immutable snapshot.

Microsoft.EntityFrameworkCore#

1
class

SharedKernelModelConfigurationExtensions

Assembly: EricksonLopez.SharedKernel.EntityFrameworkCore
public static class SharedKernelModelConfigurationExtensions

Provides extension methods for configuring strongly-typed identifiers and domain events on `ModelConfigurationBuilder` and `ModelBuilder`.

Members (4)

  • methodConfigureStrongId<TId, TValue>
    public static ModelConfigurationBuilder ConfigureStrongId<TId, TValue>(this ModelConfigurationBuilder configurationBuilder) where TId : notnull, IStrongId<TId, TValue> where TValue : notnull, IEquatable<TValue>

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

    configurationBuilder: this ModelConfigurationBuilder
    The model configuration builder.

    Returns: The modified model configuration builder instance for method chaining.

    Type parameters: TId: The strongly-typed identifier type.; TValue: The underlying primitive value type. Exceptions: ArgumentNullException: `configurationBuilder` is `null`

  • methodConfigureStrongIdsFromAssemblies
    public static ModelConfigurationBuilder ConfigureStrongIdsFromAssemblies(this ModelConfigurationBuilder configurationBuilder, params System.Reflection.Assembly[] assemblies)

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

    configurationBuilder: this ModelConfigurationBuilder
    The model configuration builder.
    assemblies: params System.Reflection.Assembly[]
    An array of assemblies to scan for strongly-typed identifier types.

    Returns: The modified model configuration builder instance for method chaining.

    Exceptions: ArgumentNullException: `configurationBuilder` or `assemblies` is `null`

  • methodConfigureStrongIdsFromAssembly
    public static ModelConfigurationBuilder ConfigureStrongIdsFromAssembly(this ModelConfigurationBuilder configurationBuilder, System.Reflection.Assembly assembly)

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

    configurationBuilder: this ModelConfigurationBuilder
    The model configuration builder.
    assembly: System.Reflection.Assembly
    The assembly to scan for strongly-typed identifier types.

    Returns: The modified model configuration builder instance for method chaining.

    Exceptions: ArgumentNullException: `configurationBuilder` or `assembly` is `null`

  • methodIgnoreDomainEvents
    public static ModelBuilder IgnoreDomainEvents(this ModelBuilder modelBuilder)

    Configures the model builder to ignore domain event draining methods across all entity types implementing `IHasDomainEvents`.

    modelBuilder: this ModelBuilder
    The model builder to configure.

    Returns: The modified model builder instance for method chaining.

    The built-in `SharedKernel.AggregateRoot<TId>` stores domain events in a `private` field. `IHasDomainEvents.DrainDomainEvents` is a method — not a property — so EF Core does not map it by default. This call is a defensive convention: it explicitly registers the member name as ignored in the model metadata, guarding against future EF Core behavior changes or custom aggregate subclasses that might inadvertently expose domain event state as a mappable property. If your aggregate subclass adds a public property of type `IReadOnlyList<IDomainEvent>` or similar, configure it explicitly per entity: `modelBuilder.Entity<Order>().Ignore(o => o.DomainEvents);` When using `DomainEventsInterceptor`, no additional configuration is required — the interceptor drains events via `IHasDomainEvents.DrainDomainEvents` which is already not a mappable property. Exceptions: ArgumentNullException: `modelBuilder` is `null`

Microsoft.Extensions.DependencyInjection#

2
class

SharedKernelEntityFrameworkServiceCollectionExtensions

Assembly: EricksonLopez.SharedKernel.EntityFrameworkCore
public static class SharedKernelEntityFrameworkServiceCollectionExtensions

Provides extension methods for registering SharedKernel Entity Framework Core interceptors and event dispatchers in an `IServiceCollection`.

Members (2)

  • methodAddSharedKernelDomainEventsInterceptor
    public static IServiceCollection AddSharedKernelDomainEventsInterceptor(this IServiceCollection services)

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

    services: this IServiceCollection
    The service collection to which the interceptor will be added.

    Returns: The service collection instance for method chaining.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddSharedKernelDomainEventsInterceptor<TDispatcher>
    public static IServiceCollection AddSharedKernelDomainEventsInterceptor<TDispatcher>(this IServiceCollection services) where TDispatcher : class, IDomainEventDispatcher

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

    services: this IServiceCollection
    The service collection to which the dispatcher and interceptor will be added.

    Returns: The service collection instance for method chaining.

    Type parameters: TDispatcher: The type of the domain event dispatcher implementation. Exceptions: ArgumentNullException: `services` is `null`

class

SharedKernelOpenTelemetryExtensions

Assembly: EricksonLopez.SharedKernel.OpenTelemetry
public static class SharedKernelOpenTelemetryExtensions

Provides extension methods for registering SharedKernel diagnostic sources with OpenTelemetry tracing and metrics builders.

Members (2)

  • methodAddSharedKernelInstrumentation
    public static MeterProviderBuilder AddSharedKernelInstrumentation(this MeterProviderBuilder builder)

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

    builder: this MeterProviderBuilder
    The meter provider builder to configure.

    Returns: The configured meter provider builder instance for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddSharedKernelInstrumentation
    public static TracerProviderBuilder AddSharedKernelInstrumentation(this TracerProviderBuilder builder)

    Adds the SharedKernel diagnostic `Diagnostics.ActivitySource` to the tracer provider builder.

    builder: this TracerProviderBuilder
    The tracer provider builder to configure.

    Returns: The configured tracer provider builder instance for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.