Descend

ExtObjectContainer#descend method allows you to navigate from a persistent object to it's members without activating or instantiating intermediate objects.

UtilityExample.cs: TestDescend
01public static void TestDescend() 02 { 03 StoreSensorPanel(); 04 IObjectContainer db = Db4oFactory.OpenFile(YapFileName); 05 try 06 { 07 db.Ext().Configure().ActivationDepth(1); 08 System.Console.WriteLine("Object container activation depth = 1"); 09 IObjectSet result = db.Get(new SensorPanel(1)); 10 SensorPanel spParent = (SensorPanel)result[0]; 11 SensorPanel spDescend = (SensorPanel)db.Ext().Descend((Object)spParent, new String[]{"_next","_next","_next","_next","_next"}); 12 db.Ext().Activate(spDescend, 5); 13 System.Console.WriteLine(spDescend); 14 } 15 finally 16 { 17 db.Close(); 18 } 19 }

UtilityExample.vb: TestDescend
01Public Shared Sub TestDescend() 02 StoreSensorPanel() 03 Dim db As IObjectContainer = Db4oFactory.OpenFile(YapFileName) 04 Try 05 db.Ext().Configure().ActivationDepth(1) 06 System.Console.WriteLine("Object container activation depth = 1") 07 Dim result As IObjectSet = db.Get(New SensorPanel(1)) 08 Dim spParent As SensorPanel = CType(result(0), SensorPanel) 09 Dim fields() As String = {"_next", "_next", "_next", "_next", "_next"} 10 Dim spDescend As SensorPanel = CType(db.Ext().Descend(CType(spParent, Object), fields), Object) 11 db.Ext().Activate(spDescend, 5) 12 System.Console.WriteLine(spDescend) 13 Finally 14 db.Close() 15 End Try 16 End Sub

Navigating in this way can save you resources on activating only the objects you really need.