Hexalith.EventStores.Abstractions 1.0.0

dotnet add package Hexalith.EventStores.Abstractions --version 1.0.0
                    
NuGet\Install-Package Hexalith.EventStores.Abstractions -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hexalith.EventStores.Abstractions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hexalith.EventStores.Abstractions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Hexalith.EventStores.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hexalith.EventStores.Abstractions --version 1.0.0
                    
#r "nuget: Hexalith.EventStores.Abstractions, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hexalith.EventStores.Abstractions@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hexalith.EventStores.Abstractions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Hexalith.EventStores.Abstractions&version=1.0.0
                    
Install as a Cake Tool

Hexalith.EventStores.Abstractions

This package defines the core abstractions and interfaces for the Hexalith.EventStores library, providing a contract for event store implementations.

Core Components

IEventStore

The IEventStore interface is the primary contract for event stores, defining methods for:

  • Adding events to a stream
  • Retrieving events with or without snapshots
  • Creating and managing snapshots
  • Managing store lifecycle (open/close)
  • Handling versioning
public interface IEventStore
{
    Task<long> AddAsync(IEnumerable<EventMessage> items, CancellationToken cancellationToken);
    Task<IEnumerable<EventMessage>> GetAsync(CancellationToken cancellationToken);
    Task<IEnumerable<EventMessage>> GetAsync(bool useSnapshot, CancellationToken cancellationToken);
    Task<IEnumerable<EventMessage>> GetAsync(long version, bool useSnapshot, CancellationToken cancellationToken);
    Task SnapshotAsync(long version, EventMessage snapshot, CancellationToken cancellationToken);
    Task<long> VersionAsync(CancellationToken cancellationToken);
    Task OpenAsync(CancellationToken cancellationToken);
    void Close();
    // Additional methods...
}

IEventStoreProvider

The IEventStoreProvider interface defines the contract for event store factory services:

public interface IEventStoreProvider
{
    Task<IEventStore> GetOrCreateStoreAsync(string id, CancellationToken cancellationToken);
    Task<bool> StoreExistsAsync(string id, CancellationToken cancellationToken);
    Task DeleteStoreAsync(string id, CancellationToken cancellationToken);
    // Additional methods...
}

EventMessage

The EventMessage record encapsulates the core data structure for events:

public record EventMessage(
    object Data,
    Metadata Metadata)
{
    // Methods and properties...
}

EventStoreHelper

The EventStoreHelper class provides utility methods for working with event stores:

  • Converting between event streams and domain objects
  • Managing event metadata
  • Helper methods for common event store operations

Configurations

The configurations namespace contains classes for configuring event stores:

  • Connection settings
  • Performance options
  • Feature toggles

Exceptions

Custom exceptions for error handling in event store operations:

  • EventStoreException: Base exception for all event store errors
  • StoreVersionMismatchException: Thrown when event sequence numbers don't match
  • StoreNotOpenException: Thrown when operations are attempted on a closed store
  • InvalidStoreSessionException: Thrown when session validation fails
  • Additional specialized exceptions

Using the Abstractions

These abstractions can be used to:

  1. Implement custom event store providers for different storage technologies
  2. Create mock implementations for testing
  3. Build higher-level abstractions for specific domain scenarios
  4. Create adapters for third-party event store technologies

Design Principles

The abstractions follow these design principles:

  • Separation of Concerns: Clear distinction between storage and domain logic
  • Interface Segregation: Focused interfaces with specific responsibilities
  • Dependency Inversion: High-level modules depend on abstractions
  • Asynchronous First: All long-running operations are async with cancellation support
  • Immutability: Events are immutable records
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Hexalith.EventStores.Abstractions:

Package Downloads
Hexalith.EventStores

Hexalith EventStores utilities and helpers

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 122 4/12/2025