This package provides core abstractions for an event store
dotnet add package NBB.EventStore.Abstractions
The following main abstractions are provided
This is the main event store abstraction that specifies how events should be added or retrieved from the store:
public interface IEventStore
{
Task AppendEventsToStreamAsync(string stream, IEnumerable<object> events, int? expectedVersion, CancellationToken cancellationToken = default);
Task<List<object>> GetEventsFromStreamAsync(string stream, int? startFromVersion, CancellationToken cancellationToken = default);
}This abstraction enables snapshotting and specifies how snapshots are stored or loaded from the store
public interface ISnapshotStore
{
Task StoreSnapshotAsync(SnapshotEnvelope snapshotEnvelope, CancellationToken cancellationToken = default);
Task<SnapshotEnvelope> LoadSnapshotAsync(string stream, CancellationToken cancellationToken = default);
}If the provider does not support snapshotting, the NullSnapshotStore that is available in this package can be registered.