CQRS.NET  4.0
A lightweight enterprise Function as a Service (FaaS) framework to write function based serverless and micro-service applications in hybrid multi-datacentre, on-premise and Azure environments.
Cqrs.Domain.SagaRepository< TAuthenticationToken > Class Template Reference

Provides basic repository methods for operations with instances of ISaga<TAuthenticationToken>. More...

+ Inheritance diagram for Cqrs.Domain.SagaRepository< TAuthenticationToken >:

Public Member Functions

 SagaRepository (IAggregateFactory sagaFactory, IEventStore< TAuthenticationToken > eventStore, IEventPublisher< TAuthenticationToken > publisher, ICommandPublisher< TAuthenticationToken > commandPublisher, ICorrelationIdHelper correlationIdHelper)
 Instantiates a new instance of SagaRepository<TAuthenticationToken> More...
 
virtual void Save< TSaga > (TSaga saga, int? expectedVersion=null)
 Save and persist the provided saga , optionally providing the version number the ISaga<TAuthenticationToken> is expected to be at. More...
 
virtual TSaga Get< TSaga > (Guid sagaId, IList< ISagaEvent< TAuthenticationToken >> events=null)
 Retrieves an ISaga<TAuthenticationToken> of type TSaga . More...
 
virtual void LoadSagaHistory< TSaga > (TSaga saga, IList< ISagaEvent< TAuthenticationToken >> events=null, bool throwExceptionOnNoEvents=true)
 If events is null, loads the events from EventStore, checks for duplicates and then rehydrates the saga with the events. More...
 

Protected Member Functions

virtual void PublishEvent (ISagaEvent< TAuthenticationToken > @event)
 Publish the saved event . More...
 
virtual void PublishCommand (IEnumerable< ICommand< TAuthenticationToken >> commands)
 Publish the commands . More...
 
virtual TSaga CreateSaga< TSaga > (Guid id)
 Calls IAggregateFactory.Create to get a, TSaga . More...
 
virtual TSaga LoadSaga< TSaga > (Guid id, IList< ISagaEvent< TAuthenticationToken >> events=null)
 Calls IAggregateFactory.Create to get a, TSaga and then calls LoadSagaHistory<TSaga>. More...
 

Properties

IEventStore< TAuthenticationToken > EventStore [get]
 Gets or sets the IEventStore<TAuthenticationToken> used to store and retrieve events from. More...
 
IEventPublisher< TAuthenticationToken > Publisher [get]
 Gets or sets the Publisher used to publish events on once saved into the EventStore. More...
 
ICommandPublisher< TAuthenticationToken > CommandPublisher [get]
 Gets or sets the Publisher used to publish an ICommand<TAuthenticationToken> More...
 
IAggregateFactory SagaFactory [get]
 Gets or set the IAggregateFactory. More...
 
ICorrelationIdHelper CorrelationIdHelper [get]
 Gets or set the ICorrelationIdHelper. More...
 

Detailed Description

Provides basic repository methods for operations with instances of ISaga<TAuthenticationToken>.

Template Parameters
TAuthenticationTokenThe Type of authentication token.