예제 #1
0
 /// <summary>
 /// Initialises a new instance of the <see cref="UnitOfWork"/> class.
 /// </summary>
 /// <param name="readOnlyDeviceId">Device Id</param>
 /// <param name="vectorClock">Vector clock</param>
 /// <param name="eventStore">Event store</param>
 /// <param name="eventBus">Message bus</param>
 public UnitOfWork(IReadOnlyDeviceId readOnlyDeviceId, IVectorClock vectorClock, IEventStore eventStore, IEventBus eventBus)
 {
     this.ReadOnlyDeviceId  = readOnlyDeviceId;
     this.VectorClock       = vectorClock.Clone(); // vector clock in unit of work must be isolated
     this.masterVectorClock = vectorClock;
     this.NewEvents         = new List <IDomainEvent>();
     this.eventStore        = eventStore;
     this.eventBus          = eventBus;
 }
예제 #2
0
 /// <summary>
 /// Initialises a new instance of the <see cref="CommandBus"/> class.
 /// </summary>
 /// <param name="dependencyInjector">Dependency injection/resolving container</param>
 /// <param name="eventBus">Message bus to publish events to</param>
 /// <param name="readOnlyDeviceId">Device id</param>
 /// <param name="vectorClock">current vector clock</param>
 /// <param name="eventStore">Event store</param>
 public CommandBus(
     IContainer dependencyInjector,
     IEventBus eventBus,
     IReadOnlyDeviceId readOnlyDeviceId,
     IVectorClock vectorClock,
     IEventStore eventStore)
 {
     this.dependencyInjectionContainer = dependencyInjector;
     this.eventBus         = eventBus;
     this.readOnlyDeviceId = readOnlyDeviceId;
     this.vectorClock      = vectorClock;
     this.eventStore       = eventStore;
 }
예제 #3
0
 /// <summary>
 /// Update the vector clock to a new value
 /// </summary>
 /// <param name="value">New value to set</param>
 public void Update(IVectorClock value)
 {
     this.vectorClock = value.GetVectorClock().Copy();
 }