コード例 #1
0
        private SnapshotDescriptor SerializeSnapshot(string streamId, object snapshot, int version)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var snapshotDescriptor = new SnapshotDescriptor(GetFullTypeName(snapshot.GetType()), _eventStoreSerDes.Serialize(snapshot), streamId, version);

            stopWatch.Stop();
            _logger.LogDebug("SnapshotStore.SerializeSnapshot for {Stream} took {ElapsedMilliseconds} ms", streamId, stopWatch.ElapsedMilliseconds);

            return(snapshotDescriptor);
        }
コード例 #2
0
        private IList <EventDescriptor> SerializeEvents(string streamId, IEnumerable <IEvent> events)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var results = new List <EventDescriptor>();

            foreach (var @event in events)
            {
                var eventDescriptor = new EventDescriptor(@event.EventId, GetFullTypeName(@event.GetType()), _eventStoreSerDes.Serialize(@event), streamId, CorrelationManager.GetCorrelationId());
                results.Add(eventDescriptor);
            }

            stopWatch.Stop();
            _logger.LogDebug("EventStore.SerializeEvents for {Stream} took {ElapsedMilliseconds} ms", streamId, stopWatch.ElapsedMilliseconds);

            return(results);
        }