public void AppendStream(Guid streamId, int expectedVersion, object[] events)
        {
            List <IEventEnvelope> eventEnvelopes = new List <IEventEnvelope>();

            long version = expectedVersion;

            foreach (var @event in events)
            {
                version++;
                eventEnvelopes.Add(new EventEnvelope(streamId, Guid.Empty, version, 0, @event));
            }

            AddEventsToStore(streamId, eventEnvelopes);

            _projectionRepository.ApplyEvents(eventEnvelopes);
        }
예제 #2
0
 public void Apply(IDocumentOperations operations, IReadOnlyList <StreamAction> streams)
 {
     foreach (var stream in streams)
     {
         var events = stream.Events.Select(e => new EventEnvelope(stream.Id, e.Id, e.Version, e.Sequence, e.Data)).ToList().AsReadOnly();
         _projectionRepository.ApplyEvents(events);
     }
 }