Class EventStore<TAuthenticationToken>
A Greg Young Event Store based EventStore<TAuthenticationToken>.
Inheritance
Inherited Members
Namespace: Cqrs.EventStore
Assembly: Cqrs.EventStore.dll
Syntax
public class EventStore<TAuthenticationToken> : IEventStore<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The System.Type of the authentication token. |
Constructors
EventStore(IEventBuilder<TAuthenticationToken>, IEventDeserialiser<TAuthenticationToken>, IEventStoreConnectionHelper)
Instantiates a new instance of EventStore<TAuthenticationToken>.
Declaration
public EventStore(IEventBuilder<TAuthenticationToken> eventBuilder, IEventDeserialiser<TAuthenticationToken> eventDeserialiser, IEventStoreConnectionHelper eventStoreConnectionHelper)
Parameters
Type | Name | Description |
---|---|---|
IEventBuilder<TAuthenticationToken> | eventBuilder | |
IEventDeserialiser<TAuthenticationToken> | eventDeserialiser | |
IEventStoreConnectionHelper | eventStoreConnectionHelper |
Fields
CqrsEventStoreStreamNamePattern
The pattern used to create stream names.
Declaration
protected const string CqrsEventStoreStreamNamePattern = "{0}/{1}"
Field Value
Type | Description |
---|---|
System.String |
Properties
EventBuilder
The IEventBuilder<TAuthenticationToken> used to build events.
Declaration
protected IEventBuilder<TAuthenticationToken> EventBuilder { get; set; }
Property Value
Type | Description |
---|---|
IEventBuilder<TAuthenticationToken> |
EventDeserialiser
The IEventDeserialiser<TAuthenticationToken> used to deserialise events.
Declaration
protected IEventDeserialiser<TAuthenticationToken> EventDeserialiser { get; set; }
Property Value
Type | Description |
---|---|
IEventDeserialiser<TAuthenticationToken> |
EventStoreConnection
The EventStore.ClientAPI.IEventStoreConnection used to read and write streams in the Greg Young Event Store.
Declaration
protected IEventStoreConnection EventStoreConnection { get; set; }
Property Value
Type | Description |
---|---|
EventStore.ClientAPI.IEventStoreConnection |
Methods
Get(Guid)
Get all IEvent<TAuthenticationToken> instances for the given correlationId
.
Declaration
public IEnumerable<EventData> Get(Guid correlationId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | correlationId | The CorrelationId of the IEvent<TAuthenticationToken> instances to retrieve. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EventData> |
Implements
Get(Type, Guid, Boolean, Int32)
Gets a collection of IEvent<TAuthenticationToken> for the IAggregateRoot<TAuthenticationToken> of type aggregateRootType
with the ID matching the provided aggregateId
.
Declaration
public IEnumerable<IEvent<TAuthenticationToken>> Get(Type aggregateRootType, Guid aggregateId, bool useLastEventOnly = false, int fromVersion = -1)
Parameters
Type | Name | Description |
---|---|---|
System.Type | aggregateRootType | System.Type of the IAggregateRoot<TAuthenticationToken> the IEvent<TAuthenticationToken> was raised in. |
System.Guid | aggregateId | The Id of the IAggregateRoot<TAuthenticationToken>. |
System.Boolean | useLastEventOnly | Loads only the last eventIEvent<TAuthenticationToken>. |
System.Int32 | fromVersion | Load events starting from this version |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IEvent<TAuthenticationToken>> |
Implements
Remarks
The value of fromVersion
is zero based but the internals indexing of the EventStore is offset by EventStore.ClientAPI.StreamPosition.Start.
Adjust the value of fromVersion
by EventStore.ClientAPI.StreamPosition.Start
Get<T>(Guid, Boolean, Int32)
Gets a collection of IEvent<TAuthenticationToken> for the T
with the ID matching the provided aggregateId
.
Declaration
public IEnumerable<IEvent<TAuthenticationToken>> Get<T>(Guid aggregateId, bool useLastEventOnly = false, int fromVersion = -1)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | aggregateId | The Id of the IAggregateRoot<TAuthenticationToken>. |
System.Boolean | useLastEventOnly | Loads only the last eventIEvent<TAuthenticationToken>. |
System.Int32 | fromVersion | Load events starting from this version |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IEvent<TAuthenticationToken>> |
Type Parameters
Name | Description |
---|---|
T | The System.Type of the IAggregateRoot<TAuthenticationToken> the IEvent<TAuthenticationToken> was raised in. |
Implements
Remarks
The value of fromVersion
is zero based but the internals indexing of the EventStore is offset by EventStore.ClientAPI.StreamPosition.Start.
Adjust the value of fromVersion
by EventStore.ClientAPI.StreamPosition.Start
ListenForNotificationsOnConnection(IEventStoreConnection)
Requests the connection
responds to OnConnect client notifications.
Declaration
protected virtual void ListenForNotificationsOnConnection(IEventStoreConnection connection)
Parameters
Type | Name | Description |
---|---|---|
EventStore.ClientAPI.IEventStoreConnection | connection | The EventStore.ClientAPI.IEventStoreConnection that will be monitored. |
Save(Type, IEvent<TAuthenticationToken>)
Saves the provided event
.
Declaration
public void Save(Type aggregateRootType, IEvent<TAuthenticationToken> event)
Parameters
Type | Name | Description |
---|---|---|
System.Type | aggregateRootType | System.Type of the IAggregateRoot<TAuthenticationToken> the IEvent<TAuthenticationToken> was raised in. |
IEvent<TAuthenticationToken> | event | The IEvent<TAuthenticationToken> to be saved. |
Implements
Save<T>(IEvent<TAuthenticationToken>)
Saves the provided event
.
Declaration
public void Save<T>(IEvent<TAuthenticationToken> event)
Parameters
Type | Name | Description |
---|---|---|
IEvent<TAuthenticationToken> | event | The IEvent<TAuthenticationToken> to be saved. |
Type Parameters
Name | Description |
---|---|
T | The System.Type of the IAggregateRoot<TAuthenticationToken> the IEvent<TAuthenticationToken> was raised in. |