Exemple #1
0
 public void LargeObject()
 {
   // 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 large = new LargeObject((int) Math.Pow(2, 25)); // Math.Pow(2, 27) too large to handle with ToBase64String for csv export
     id = session.Persist(large);
     Assert.True(large.IsOK());
     session.Commit();
   }
   using (SessionNoServer session = new SessionNoServer(s_systemDir))
   {
     session.BeginRead();
     var large = session.Open<LargeObject>(id);
     Assert.True(large.IsOK());
     session.Commit();
   }
 }
Exemple #2
0
 public void TooLargeObject()
 {
   Assert.Throws<OverflowException>(() =>
   {
     UInt64 id;
     using (SessionNoServer session = new SessionNoServer(s_systemDir))
     {
       session.BeginUpdate();
       var large = new LargeObject((int)Math.Pow(2, 28));
       id = session.Persist(large);
       Assert.True(large.IsOK());
       session.Commit();
     }
     using (SessionNoServer session = new SessionNoServer(s_systemDir))
     {
       session.BeginRead();
       var large = session.Open<LargeObject>(id);
       Assert.True(large.IsOK());
       session.Commit();
     }
   });
 }