Inheritance: OptimizedPersistable
 public void ListWrapperTest()
 {
   // max length of an array is int.MaxValue, objects on a page are serialized to a single byte[] so this array must have a length < int.MaxValue
   UInt64 id;
   using (SessionNoServer session = new SessionNoServer(s_systemDir))
   {
     session.BeginUpdate();
     var f = new FourPerPage(1);
     id = session.Persist(f);
     Assert.True(f.IsOK());
     session.Commit();
   }
   using (SessionNoServer session = new SessionNoServer(s_systemDir))
   {
     session.BeginRead();
     var f = session.Open<FourPerPage>(id);
     Assert.True(f.IsOK());
     session.Commit();
   }
 }
Exemple #2
0
    public void cSyncNewPages()
    {
      using (SessionBase session = new SessionNoServer(s_sync1))
      {
        using (var trans = session.BeginUpdate())
        {
          for (uint i = 0; i < 100; i++)
          {
            FourPerPage fourPerPage = new FourPerPage(i);
            session.Persist(fourPerPage);
          }
          session.Commit();
        }
      }

      using (SessionBase readFromSession = new SessionNoServer(s_sync1))
      {
        using (SessionBase updateSession = new SessionNoServer(s_sync2))
        {
          updateSession.SyncWith(readFromSession);
        }
      }

      using (SessionBase readFromSession = new SessionNoServer(s_sync1))
      {
        readFromSession.BeginRead();
        using (SessionBase updateSession = new SessionNoServer(s_sync2))
        {
          using (var trans = updateSession.BeginRead())
          {
            Assert.AreEqual(updateSession.AllObjects<FourPerPage>().Count, readFromSession.AllObjects<FourPerPage>().Count);
          }
        }
      }
    }