VOOZH about

URL: https://www.nuget.org/packages/Hexalith.EventStores.Abstractions/

⇱ NuGet Gallery | Hexalith.EventStores.Abstractions 1.3.0




👁 Image
Hexalith.EventStores.Abstractions 1.3.0

dotnet add package Hexalith.EventStores.Abstractions --version 1.3.0
 
 
NuGet\Install-Package Hexalith.EventStores.Abstractions -Version 1.3.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.3.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.3.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.3.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Hexalith.EventStores.Abstractions, 1.3.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.3.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.3.0
 
Install as a Cake Addin
#tool nuget:?package=Hexalith.EventStores.Abstractions&version=1.3.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Hexalith.EventStores

A lightweight and efficient event store implementation for .NET applications using event sourcing patterns. This library provides a robust foundation for building event-sourced systems with support for event persistence, snapshots, and versioning.

Build Status

👁 License: MIT
👁 Discord

👁 Codacy Badge
👁 Quality Gate Status
👁 Security Rating
👁 Maintainability Rating
👁 Code Smells
👁 Lines of Code
👁 Technical Debt
👁 Reliability Rating
👁 Duplicated Lines (%)
👁 Vulnerabilities
👁 Bugs

👁 Build status
👁 NuGet
👁 Latest

Overview

Hexalith.EventStores provides a flexible event storage solution for applications implementing event sourcing patterns. It offers:

  • Event stream persistence with versioning
  • Snapshot support for performance optimization
  • Concurrent access control with session management
  • Abstract interfaces for implementing different storage backends
  • Thread-safe operations with cancellation support

Key Components

Abstractions

  • IEventStore: Core interface for event store operations (add, get, snapshot, version management)
  • IEventStoreProvider: Factory interface for opening event store instances
  • EventMessage: Container for polymorphic event with metadata

Implementations

  • KeyValueEventStore: Implementation using key-value storage for persistence
  • KeyValueEventStoreProvider: Provider for creating KeyValueEventStore instances

Getting Started

Installation

dotnet add package Hexalith.EventStores

Basic Usage

// Create event store provider
IKeyValueProvider keyValueProvider = new YourKeyValueProvider();
IEventStoreProvider provider = new KeyValueEventStoreProvider(keyValueProvider);

// Open an event store (creates if not exists)
IEventStore store = await provider.OpenStoreAsync(
 "YourAggregateName",
 "YourAggregateId",
 cancellationToken);

try
{
 // Store events using the helper extension method
 var events = new List<EventMessage>
 {
 new YourDomainEvent { /* event data */ }.CreateMessage()
 };

 long version = await store.AddAsync(events, cancellationToken);

 // Retrieve events
 IEnumerable<EventMessage> storedEvents = await store.GetAsync(cancellationToken);

 // Create a snapshot
 await store.SnapshotAsync(
 version,
 CalculateSnapshot(storedEvents),
 cancellationToken);
}
finally
{
 // Close the store when done
 store.Close();
}

Advanced Features

Snapshots

Snapshots allow for efficient retrieval of event stream state without replaying all events:

// Create a snapshot at the current version
long version = await store.VersionAsync(cancellationToken);
await store.SnapshotAsync(
 version,
 CalculateSnapshot(events),
 cancellationToken);

// Retrieve using snapshot
var events = await store.GetAsync(useSnapshot: true, cancellationToken);

Session Management

The event store implements session-based locking to prevent concurrent access. When using OpenStoreAsync, the store is automatically opened. For custom timeout configuration:

// Open with custom timeouts (after getting the store)
await store.OpenAsync(
 TimeSpan.FromMinutes(5), // session timeout
 TimeSpan.FromSeconds(10), // open timeout
 cancellationToken);

Examples

The repository includes examples demonstrating how to use Hexalith.EventStores in practical scenarios:

Bank Account Example

A simple application that demonstrates core event sourcing concepts using a bank account domain model:

  • Creating and using an event store with file-based persistence
  • Implementing domain events with polymorphic serialization
  • Adding and retrieving events with proper sequencing
  • Modeling a domain with C# records and event sourcing patterns

Additional Examples (Planned)

Future releases will include examples covering:

  • Domain-Driven Design with event sourcing
  • Microservices communication patterns
  • Performance optimization techniques
  • Custom storage backend implementations

Repository Structure

The repository is organized as follows:

  • : Source code for the event store libraries
    • Hexalith.EventStores.Abstractions: Core interfaces and models
    • Hexalith.EventStores: Implementation of the event store
  • : Test projects
  • : Example implementations
  • : Shared build configurations

License

This project is licensed under the MIT License - see the file for details.

Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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.3.0 146 1/3/2026
1.2.0 124 1/3/2026
1.1.0 130 1/3/2026
1.0.0 214 4/12/2025