Пример #1
0
        /// <inheritdoc />
        public void WritePageVersion(DataPageVersion dataPageVersion)
        {
            var versionJson = JObject.FromObject(dataPageVersion);

            var value = versionJson.ToString(Formatting.None);

            AppendFile(VersionsFilePath, $"{dataPageVersion.DataPagePath}:{value}");
            WriteFile(Path.Combine(VersionsRootPath, $"{dataPageVersion.VersionGuid}.json"),
                      JsonConvert.SerializeObject(dataPageVersion.DataPage, SerializerSettings));
        }
Пример #2
0
        /// <summary>
        /// Saves the version.
        /// </summary>
        /// <param name="page">The page.</param>
        public void SaveVersion(DataPage page)
        {
            var versions      = GetVersions(page).ToArray();
            var versionNumber = versions.Any() ? versions.Max(p => p.VersionNumber) + 1 : 1;

            var versionObject = new DataPageVersion(
                Guid.NewGuid(),
                Utils.GetDataPagePath(page),
                DateTime.Now,
                versionNumber,
                page);

            DatabaseHelper.WritePageVersion(versionObject);
        }