Class MongoDbEventStore<TAuthenticationToken>
A MongoDB based EventStore<TAuthenticationToken>.
Inherited Members
Namespace: Cqrs.MongoDB.Events
Assembly: Cqrs.MongoDB.dll
Syntax
public class MongoDbEventStore<TAuthenticationToken> : EventStore<TAuthenticationToken>, IEventStore<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The System.Type of the authentication token. |
Constructors
MongoDbEventStore(IEventBuilder<TAuthenticationToken>, IEventDeserialiser<TAuthenticationToken>, ILogger, IMongoDbEventStoreConnectionStringFactory, IConfigurationManager)
Instantiate a new instance of MongoDbEventStore<TAuthenticationToken> triggering any require index checks.
Declaration
public MongoDbEventStore(IEventBuilder<TAuthenticationToken> eventBuilder, IEventDeserialiser<TAuthenticationToken> eventDeserialiser, ILogger logger, IMongoDbEventStoreConnectionStringFactory mongoDbEventStoreConnectionStringFactory, IConfigurationManager configurationManager)
Parameters
Type | Name | Description |
---|---|---|
IEventBuilder<TAuthenticationToken> | eventBuilder | |
IEventDeserialiser<TAuthenticationToken> | eventDeserialiser | |
cdmdotnet.Logging.ILogger | logger | |
IMongoDbEventStoreConnectionStringFactory | mongoDbEventStoreConnectionStringFactory | |
IConfigurationManager | configurationManager |
Properties
ConfigurationManager
Gets or sets the IConfigurationManager
Declaration
protected IConfigurationManager ConfigurationManager { get; }
Property Value
Type | Description |
---|---|
IConfigurationManager |
MongoCollection
Gets or sets the MongoDB.Driver.IMongoCollection<TDocument>
Declaration
protected IMongoCollection<MongoDbEventData> MongoCollection { get; }
Property Value
Type | Description |
---|---|
MongoDB.Driver.IMongoCollection<MongoDbEventData> |
MongoDbEventStoreConnectionStringFactory
Gets or sets the IMongoDbEventStoreConnectionStringFactory
Declaration
protected IMongoDbEventStoreConnectionStringFactory MongoDbEventStoreConnectionStringFactory { get; }
Property Value
Type | Description |
---|---|
IMongoDbEventStoreConnectionStringFactory |
Methods
Get(Guid)
Get all IEvent<TAuthenticationToken> instances for the given correlationId
.
Declaration
public override 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> |
Overrides
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 override 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>> |
Overrides
GetCollection()
Get a MongoDB.Driver.IMongoCollection<TDocument>
Declaration
protected virtual IMongoCollection<MongoDbEventData> GetCollection()
Returns
Type | Description |
---|---|
MongoDB.Driver.IMongoCollection<MongoDbEventData> |
PersistEvent(EventData)
Persist the provided eventData
into storage.
Declaration
protected override void PersistEvent(EventData eventData)
Parameters
Type | Name | Description |
---|---|---|
EventData | eventData | The EventData to persist. |
Overrides
VerifyIndex(MongoDbIndex<MongoDbEventData>)
Verify the provided mongoIndex
is defined and ready to go.
Declaration
protected virtual void VerifyIndex(MongoDbIndex<MongoDbEventData> mongoIndex)
Parameters
Type | Name | Description |
---|---|---|
MongoDbIndex<MongoDbEventData> | mongoIndex |
VerifyIndexes()
Verify all required MongoDbIndex<TEntity> are defined and ready to go.
Declaration
protected virtual void VerifyIndexes()