ExtObjectContainer#descend method allows you to navigate from a persistent object to it's members without activating or instantiating intermediate objects.
UtilityExample.cs: TestDescend public static void TestDescend() { StoreSensorPanel(); IConfiguration configuration = Db4oFactory.NewConfiguration(); configuration.ActivationDepth(1); IObjectContainer db = Db4oFactory.OpenFile( configuration, Db4oFileName); try { System.Console.WriteLine("Object container activation depth = 1"); IObjectSet result = db.QueryByExample(new SensorPanel(1)); SensorPanel spParent = (SensorPanel)result[0]; SensorPanel spDescend = (SensorPanel)db.Ext(). Descend((Object)spParent, new String[] {"_next","_next", "_next","_next","_next"}); db.Ext().Activate(spDescend, 5); System.Console.WriteLine(spDescend); } finally { db.Close(); } }
UtilityExample.vb: TestDescend Public Shared Sub TestDescend() StoreSensorPanel() Dim configuration As IConfiguration = Db4oFactory.NewConfiguration() configuration.ActivationDepth(1) Dim db As IObjectContainer = Db4oFactory.OpenFile(configuration, _ Db4oFileName) Try System.Console.WriteLine("Object container activation depth = 1") Dim result As IObjectSet = db.QueryByExample(New SensorPanel(1)) Dim spParent As SensorPanel = CType(result(0), SensorPanel) Dim fields() As String = {"_next", "_next", "_next", "_next", "_next"} Dim spDescend As SensorPanel = CType(db.Ext().Descend( _ CType(spParent, Object), fields), Object) db.Ext().Activate(spDescend, 5) System.Console.WriteLine(spDescend) Finally db.Close() End Try End Sub
Navigating in this way can save you resources on activating only the objects you really need.
Download example code: