예제 #1
0
            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);
            }
예제 #2
0
            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);
            }
예제 #3
0
 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();
     }
 }