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 IConfiguration configuration = Db4oFactory.NewConfiguration(); 05 configuration.ActivationDepth(1); 06 IObjectContainer db = Db4oFactory.OpenFile(configuration, Db4oFileName); 07 try 08 { 09 System.Console.WriteLine("Object container activation depth = 1"); 10 IObjectSet result = db.Get(new SensorPanel(1)); 11 SensorPanel spParent = (SensorPanel)result[0]; 12 SensorPanel spDescend = (SensorPanel)db.Ext().Descend((Object)spParent, new String[]{"_next","_next","_next","_next","_next"}); 13 db.Ext().Activate(spDescend, 5); 14 System.Console.WriteLine(spDescend); 15 } 16 finally 17 { 18 db.Close(); 19 } 20 }

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

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