예제 #1
0
        public void AutoPlacementDbRollover(int howMany)
        {
            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginUpdate();
                FourPerPage f;
                for (UInt64 i = 0; i < 1000000; i++)
                {
                    f = new FourPerPage(i);
                    session.Persist(f);
                }
                session.Commit();
            }

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginRead();
                UInt32   dbNum = session.DatabaseNumberOf(typeof(FourPerPage));
                Database db    = session.OpenDatabase(dbNum);
                int      ct    = 0;
                foreach (FourPerPage f in db.AllObjects <FourPerPage>())
                {
                    ct++;
                }
                Assert.AreEqual(ct, howMany);
                session.Commit();
            }
        }
예제 #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 (var updateSession = new SessionNoServerShared(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);
                    }
                }
            }
        }
예제 #3
0
        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();
            }
        }