Inheritance: OptimizedPersistable
Ejemplo n.º 1
0
    public void LazyLoadDepth()
    {
      UInt64 id;
      using (SessionNoServer session = new SessionNoServer(systemDir))
      {
        session.BeginUpdate();
        LazyLoadByDepth lazy = null;
        for (uint i = 1; i <= 100; i++)
          lazy = new LazyLoadByDepth(i, lazy);
        session.Persist(lazy);
        id = lazy.Id;
        session.Commit();
      }

      using (SessionNoServer session = new SessionNoServer(systemDir))
      {
        UInt32 ct = 100;
        session.BeginRead();
        LazyLoadByDepth lazy = (LazyLoadByDepth)session.Open(id, false, false, 0); // load only the root of the object graph
        Assert.AreEqual(ct--, lazy.MyCt);
        Assert.IsNull(lazy.MyRefPeek);
        Assert.NotNull(lazy.MyRef);
        Assert.NotNull(lazy.MyRefPeek);
        lazy = lazy.MyRef;
        Assert.AreEqual(ct--, lazy.MyCt);
        Assert.IsNull(lazy.MyRefPeek);
        Assert.NotNull(lazy.MyRef);
        Assert.NotNull(lazy.MyRefPeek);
        lazy = lazy.MyRef;
        Assert.AreEqual(ct--, lazy.MyCt);
        Assert.IsNull(lazy.MyRefPeek);
        Assert.NotNull(lazy.MyRef);
        Assert.NotNull(lazy.MyRefPeek);        
        lazy = lazy.MyRef;
        Assert.AreEqual(ct--, lazy.MyCt);
        Assert.IsNull(lazy.MyRefPeek);
        Assert.NotNull(lazy.MyRef);
        Assert.NotNull(lazy.MyRefPeek);
        session.Commit();
      }
    }
Ejemplo n.º 2
0
 public LazyLoadByDepth(UInt32 ct, LazyLoadByDepth aRef)
 {
     myRef   = aRef;
     this.ct = ct;
 }
Ejemplo n.º 3
0
 public LazyLoadByDepth(UInt32 ct, LazyLoadByDepth aRef)
 {
   myRef = aRef;
   this.ct = ct;
 }