Esempio n. 1
0
 public void TwoUpdaters2()
 {
     Assert.Throws <OpenDatabaseException>(() =>
     {
         UInt64 id;
         try
         {
             using (var session = new SessionNoServerShared(systemDir))
             {
                 session.BeginUpdate();
                 Man man = new Man();
                 man.Persist(session, man);
                 id = man.Id;
                 session.Commit();
                 session.BeginUpdate();
                 man.Age = ++man.Age;
                 session.FlushUpdates();
                 using (SessionNoServer session2 = new SessionNoServer(systemDir))
                 {
                     session2.BeginRead();
                     Man man2 = (Man)session2.Open(id);
                     Assert.Less(man2.Age, man.Age);
                     man2.Age = ++man.Age; // We'll get the OpenDatabase exception here since we are not in an update transaction
                     session2.Commit();
                 }
                 session.Commit();
                 session.Verify();
             }
         }
         finally
         {
             System.GC.Collect();
         }
     });
 }