CQRS.NET  2.2
A lightweight enterprise framework to write CQRS, event-sourced and micro-service applications in hybrid multi-datacentre, on-premise and Azure environments.
Cqrs.Events.ReplicatedSqlEventStore< TAuthenticationToken > Class Template Reference

A simplified SqlServer based EventStore<TAuthenticationToken> that uses LinqToSql and follows a rigid schema that also replicates to multiple connections, but only reads from one connection. More...

+ Inheritance diagram for Cqrs.Events.ReplicatedSqlEventStore< TAuthenticationToken >:

Public Member Functions

 ReplicatedSqlEventStore (IEventBuilder< TAuthenticationToken > eventBuilder, IEventDeserialiser< TAuthenticationToken > eventDeserialiser, ILogger logger, IConfigurationManager configurationManager)
 Instantiates and Initialises a new instance of the ReplicatedSqlEventStore<TAuthenticationToken> class. More...
 
- Public Member Functions inherited from Cqrs.Events.SqlEventStore< TAuthenticationToken >
 SqlEventStore (IEventBuilder< TAuthenticationToken > eventBuilder, IEventDeserialiser< TAuthenticationToken > eventDeserialiser, ILogger logger, IConfigurationManager configurationManager)
 Instantiate a new instance of the SqlEventStore<TAuthenticationToken> class. More...
 
override IEnumerable< IEvent< TAuthenticationToken > > Get (Type aggregateRootType, Guid aggregateId, bool useLastEventOnly=false, int fromVersion=-1)
 Gets a collection of IEvent<TAuthenticationToken> for the IAggregateRoot<TAuthenticationToken> of type aggregateRootType with the ID matching the provided aggregateId . More...
 
override IEnumerable< IEvent< TAuthenticationToken > > GetToVersion (Type aggregateRootType, Guid aggregateId, int version)
 Gets a collection of IEvent<TAuthenticationToken> for the IAggregateRoot<TAuthenticationToken> of type aggregateRootType with the ID matching the provided aggregateId up to and including the provided version . More...
 
override IEnumerable< IEvent< TAuthenticationToken > > GetToDate (Type aggregateRootType, Guid aggregateId, DateTime versionedDate)
 Gets a collection of IEvent<TAuthenticationToken> for the IAggregateRoot<TAuthenticationToken> of type aggregateRootType with the ID matching the provided aggregateId up to and including the provided versionedDate . More...
 
override IEnumerable< IEvent< TAuthenticationToken > > GetBetweenDates (Type aggregateRootType, Guid aggregateId, DateTime fromVersionedDate, DateTime toVersionedDate)
 Gets a collection of IEvent<TAuthenticationToken> for the IAggregateRoot<TAuthenticationToken> of type aggregateRootType with the ID matching the provided aggregateId from and including the provided fromVersionedDate up to and including the provided toVersionedDate . More...
 
override IEnumerable< EventDataGet (Guid correlationId)
 Get all IEvent<TAuthenticationToken> instances for the given correlationId . More...
 
- Public Member Functions inherited from Cqrs.Events.EventStore< TAuthenticationToken >
virtual void Save< T > (IEvent< TAuthenticationToken > @event)
 Saves the provided event . More...
 
virtual void Save (Type aggregateRootType, IEvent< TAuthenticationToken > @event)
 Saves the provided event . More...
 
virtual IEnumerable< IEvent< TAuthenticationToken > > Get< T > (Guid aggregateId, bool useLastEventOnly=false, int fromVersion=-1)
 Gets a collection of IEvent<TAuthenticationToken> for the T aggregate root with the ID matching the provided aggregateId . More...
 
virtual IEnumerable< IEvent< TAuthenticationToken > > GetToVersion< T > (Guid aggregateId, int version)
 Gets a collection of IEvent<TAuthenticationToken> for the T aggregate root with the ID matching the provided aggregateId up to and including the provided version . More...
 
virtual IEnumerable< IEvent< TAuthenticationToken > > GetToDate< T > (Guid aggregateId, DateTime versionedDate)
 Gets a collection of IEvent<TAuthenticationToken> for the T aggregate root with the ID matching the provided aggregateId up to and including the provided versionedDate . More...
 
virtual IEnumerable< IEvent< TAuthenticationToken > > GetBetweenDates< T > (Guid aggregateId, DateTime fromVersionedDate, DateTime toVersionedDate)
 Gets a collection of IEvent<TAuthenticationToken> for the T aggregate root with the ID matching the provided aggregateId from and including the provided fromVersionedDate up to and including the provided toVersionedDate . More...
 

Protected Member Functions

override void PersistEvent (EventData eventData)
 Persist the provided eventData into each SQL Server in WritableConnectionStrings. A single TransactionScope wraps all SQL servers, so all must complete successfully, or they will ALL roll back. More...
 
- Protected Member Functions inherited from Cqrs.Events.SqlEventStore< TAuthenticationToken >
override void PersistEvent (EventData eventData)
 Persist the provided eventData into SQL Server. More...
 
virtual DataContext CreateDbDataContext (string aggregateRootTypeName=null)
 Creates a new DataContext using connection string settings from ConfigurationManager. More...
 
virtual Table< EventDataGetEventStoreTable (DataContext dbDataContext)
 Gets the Table<TEntity> of EventData. More...
 
virtual void Add (DataContext dbDataContext, EventData data)
 Persist the provided data into SQL Server using the provided dbDataContext . More...
 
- Protected Member Functions inherited from Cqrs.Events.EventStore< TAuthenticationToken >
 EventStore (IEventBuilder< TAuthenticationToken > eventBuilder, IEventDeserialiser< TAuthenticationToken > eventDeserialiser, ILogger logger)
 Instantiates a new instance of EventStore<TAuthenticationToken>. More...
 
virtual string GenerateStreamName (Type aggregateRootType, IEvent< TAuthenticationToken > @event)
 Generate a unique stream name based on the provided aggregateRootType and the IEvent<TAuthenticationToken>.Id from the provided event . More...
 
virtual string GenerateStreamName (Type aggregateRootType, Guid aggregateId)
 Generate a unique stream name based on the provided aggregateRootType and the aggregateId . More...
 

Properties

IEnumerable< string > WritableConnectionStrings [get]
 A collection of connection strings that are used to write to the database. More...
 
- Properties inherited from Cqrs.Events.SqlEventStore< TAuthenticationToken >
IConfigurationManager ConfigurationManager [get]
 Gets or sets the IConfigurationManager. More...
 
- Properties inherited from Cqrs.Events.EventStore< TAuthenticationToken >
IEventBuilder< TAuthenticationToken > EventBuilder [get, set]
 The IEventBuilder<TAuthenticationToken> used to build events. More...
 
IEventDeserialiser< TAuthenticationToken > EventDeserialiser [get, set]
 The IEventDeserialiser<TAuthenticationToken> used to deserialise events. More...
 
ITelemetryHelper TelemetryHelper [get, set]
 The ITelemetryHelper to use. More...
 
ILogger Logger [get]
 The ILogger to use. More...
 

Additional Inherited Members

- Protected Attributes inherited from Cqrs.Events.EventStore< TAuthenticationToken >
const string CqrsEventStoreStreamNamePattern = "{0}/{1}"
 The pattern used to generate the stream name. More...
 

Detailed Description

A simplified SqlServer based EventStore<TAuthenticationToken> that uses LinqToSql and follows a rigid schema that also replicates to multiple connections, but only reads from one connection.

Template Parameters
TAuthenticationTokenThe Type of the authentication token.