public override Page GetVersion(Page o, int version) { VersionPath versionPath = new VersionPath(o, version); var versionDataFile = Path.Combine(versionPath.PhysicalPath, o.DataFileName); Page page = null; if (File.Exists(versionDataFile)) { PageProvider provider = new PageProvider(); page = provider.Deserialize(o, versionDataFile); ((IPersistable)page).Init(o); } return(page); }
public override Page GetVersion(Page o, int version) { VersionPath versionPath = new VersionPath(o, version); var versionDataFile = Path.Combine(versionPath.PhysicalPath, o.DataFileName); Page page = null; if (File.Exists(versionDataFile)) { PageProvider provider = new PageProvider(); page = (Page)Kooboo.Runtime.Serialization.DataContractSerializationHelper.Deserialize(typeof(Page), KnownTypes, versionDataFile); ((IPersistable)page).Init(o); } return(page); }
public override void LogVersion(Page o) { locker.EnterWriteLock(); try { VersionPath versionPath = new VersionPath(o, NextVersionId(o)); IOUtility.EnsureDirectoryExists(versionPath.PhysicalPath); var versionDataFile = Path.Combine(versionPath.PhysicalPath, o.DataFileName); PageProvider provider = new PageProvider(); provider.Serialize(o, versionDataFile); } finally { locker.ExitWriteLock(); } }