public static void SaveSnapshot() { foreach (EDSSettings EDS in SettingsStore.EDSSettings.Where(e => e.Name != "Template")) { MetaDataSnapshot metaDataSnapshot = new MetaDataSnapshot(EDS.ConnectionString); Console.WriteLine(metaDataSnapshot); MetaDataStore.Provider.SaveSnapshot(EDS, metaDataSnapshot); } }
public static void SetSnapshots <TDataSnapshotValue>(this MetaDataSnapshot self, IEnumerable <TDataSnapshotValue> snapshots) { if (self == null) { throw new ArgumentNullException(nameof(self)); } if (snapshots == null) { throw new ArgumentNullException(nameof(snapshots)); } var json = JsonConvert.SerializeObject(snapshots); self.Data = Encoding.UTF8.GetBytes(json); }
private void CreateSnapshot() { Logger.Common("Creating snapshots"); // Traverse through every single EDS and save a snapshot of it foreach (EDSSettings EDS in SettingsStore.EDSSettings.Where(e => e.Name != "Template")) { Logger.Common($"Creating snapshot for {EDS.Name}"); MetaDataSnapshot metaDataSnapshot = new MetaDataSnapshot(EDS.ConnectionString); Console.WriteLine(metaDataSnapshot); Logger.Common($"Saving snapshot for {EDS.Name}"); MetaDataStore.Provider.SaveSnapshot(EDS, metaDataSnapshot); Logger.Common($"Finishing snapshot for {EDS.Name}"); } Logger.Common($"Finished creating ({SettingsStore.EDSSettings.Count(e => e.Name != "Template")}) snapshots"); }
public static IEnumerable <TDataSnapshotValue> GetSnapshots <TDataSnapshotValue>(this MetaDataSnapshot self) { if (self == null) { throw new ArgumentNullException(nameof(self)); } if (self.Data == null || self.Data.Length == 0) { return(Enumerable.Empty <TDataSnapshotValue>()); } var json = Encoding.UTF8.GetString(self.Data); return(JsonConvert.DeserializeObject <IEnumerable <TDataSnapshotValue> >(json)); }