Exemple #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);
        }
Exemple #2
0
        private object DeserializeSnapshot(string streamId, SnapshotDescriptor snapshotDescriptor)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var snapshot = _eventStoreSerDes.Deserialize(snapshotDescriptor.SnapshotData,
                                                         Type.GetType(snapshotDescriptor.SnapshotType));

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

            return(snapshot);
        }