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
<PackageReference Include="Hexalith.EventStores.Abstractions" Version="1.0.0" />
<PackageVersion Include="Hexalith.EventStores.Abstractions" Version="1.0.0" />
<PackageReference Include="Hexalith.EventStores.Abstractions" />
paket add Hexalith.EventStores.Abstractions --version 1.0.0
#r "nuget: Hexalith.EventStores.Abstractions, 1.0.0"
#:package Hexalith.EventStores.Abstractions@1.0.0
#addin nuget:?package=Hexalith.EventStores.Abstractions&version=1.0.0
#tool nuget:?package=Hexalith.EventStores.Abstractions&version=1.0.0
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 errorsStoreVersionMismatchException
: Thrown when event sequence numbers don't matchStoreNotOpenException
: Thrown when operations are attempted on a closed storeInvalidStoreSessionException
: Thrown when session validation fails- Additional specialized exceptions
Using the Abstractions
These abstractions can be used to:
- Implement custom event store providers for different storage technologies
- Create mock implementations for testing
- Build higher-level abstractions for specific domain scenarios
- 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 | Versions 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. |
-
net9.0
- Hexalith.Commons.Configurations (>= 1.66.4)
- Hexalith.Commons.Metadatas (>= 1.66.4)
- Hexalith.PolymorphicSerializations (>= 1.6.2)
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 |