Example #1
0
 protected override Snapshot WriteSnapshotImpl(Model model)
 {
     var fileSnapshot = new FileSnapshot(DateTime.Now, model.Revision);
     var fileName = Path.Combine(_config.Location.OfSnapshots, fileSnapshot.Name);
     using (Stream stream =  new FileStream(fileName, FileMode.Create, FileAccess.Write))
     {
         _formatter.Serialize(stream, model);
     }
     return fileSnapshot;
 }
Example #2
0
 protected override Snapshot WriteSnapshotImpl(Model model, ulong lastAppliedEntryId)
 {
     var fileSnapshot = new FileSnapshot(DateTime.Now, lastAppliedEntryId);
     var fileName = Path.Combine(_config.Location.OfSnapshots, fileSnapshot.Name);
     using (Stream stream = GetWriteStream(fileName, append:false))
     {
         _snapshotFormatter.Serialize(stream, model);
     }
     return fileSnapshot;
 }