예제 #1
0
파일: Program.cs 프로젝트: sajens/MAIME
        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);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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");
        }
예제 #4
0
        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));
        }