Class InProcessEventStore<TAuthenticationToken>
An IEventStore<TAuthenticationToken> that uses a local (non-static) System.Collections.Generic.IDictionary<TKey, TValue>. This does not manage memory in any way and will continue to grow. Mostly suitable for running tests or short lived processes.
Inheritance
Inherited Members
Namespace: Cqrs.Events
Assembly: Cqrs.dll
Syntax
public class InProcessEventStore<TAuthenticationToken> : IEventStore<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The System.Type of the authentication token. |
Constructors
InProcessEventStore()
Instantiate a new instance of the InProcessEventStore<TAuthenticationToken> class.
Declaration
public InProcessEventStore()
Properties
InMemoryDb
Gets or sets the in-memory storage System.Collections.Generic.IDictionary<TKey, TValue>.
Declaration
protected IDictionary<Guid, IList<IEvent<TAuthenticationToken>>> InMemoryDb { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.Guid, System.Collections.Generic.IList<IEvent<TAuthenticationToken>>> |
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 aggregateType
with the ID matching the provided aggregateId
.
Declaration
public IEnumerable<IEvent<TAuthenticationToken>> Get(Type aggregateType, Guid aggregateId, bool useLastEventOnly = false, int fromVersion = -1)
Parameters
Type | Name | Description |
---|---|---|
System.Type | aggregateType | 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
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
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. |