Class Neo4jEventStore
เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน
Namespace: Cephalon.EventSourcing.Neo4j
Assembly: Cephalon.EventSourcing.Neo4j.dll
Neo4j-backed implementation of :Event node with a compound node key constraint on
(streamId, streamVersion) enforcing optimistic concurrency at the database level.
public sealed class Neo4jEventStore : IEventStoreInheritance
Section titled “Inheritance”Implements
Section titled “Implements”IEventStore
Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Section titled “Constructors”Neo4jEventStore(IDriver, string)
Section titled “ Neo4jEventStore(IDriver, string)”Initializes a new instance of the
public Neo4jEventStore(IDriver driver, string eventLabel = "Event")Parameters
Section titled “Parameters”driver IDriver
The Neo4j driver used to open sessions.
eventLabel string
The node label used for event nodes. Defaults to Event.
Methods
Section titled “Methods”AppendAsync(string, IReadOnlyCollection<IDomainEvent>, long, CancellationToken)
Section titled “ AppendAsync(string, IReadOnlyCollection<IDomainEvent>, long, CancellationToken)”Appends one or more events to the requested stream after checking the expected version.
public Task AppendAsync(string streamId, IReadOnlyCollection<IDomainEvent> events, long expectedVersion, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
events IReadOnlyCollection<IDomainEvent>
The events to append.
expectedVersion long
The current stream version expected by the caller. Use -1 to require a brand-new stream.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”A task that completes when the append finishes.
GetVersionAsync(string, CancellationToken)
Section titled “ GetVersionAsync(string, CancellationToken)”Gets the latest version known for the requested stream.
public Task<long> GetVersionAsync(string streamId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”A task that returns the current stream version, or -1 when the stream does not exist.
ReadStreamAsync(string, long, CancellationToken)
Section titled “ ReadStreamAsync(string, long, CancellationToken)”Reads the requested stream from the supplied version onward.
public IAsyncEnumerable<IDomainEvent> ReadStreamAsync(string streamId, long fromVersion = 0, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
fromVersion long
The first stream version to include. The default is 0.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”IAsyncEnumerable<IDomainEvent>
An async sequence of domain events in ascending stream-version order.