ExtObjectContainer.isActive method provides you with means to define if the object is active.
UtilityExample.cs: CheckActive
public static void CheckActive()
{
StoreSensorPanel();
IConfiguration configuration = Db4oFactory.NewConfiguration();
configuration.ActivationDepth(2);
IObjectContainer db = Db4oFactory.OpenFile(configuration, Db4oFileName);
try
{
System.Console.WriteLine("Object container activation depth = 2");
IObjectSet result = db.QueryByExample(new SensorPanel(1));
SensorPanel sensor = (SensorPanel)result[0];
SensorPanel next = sensor.Next;
while (next != null)
{
System.Console.WriteLine("Object " + next +" is active: "
+ db.Ext().IsActive(next));
next = next.Next;
}
}
finally
{
db.Close();
}
}
UtilityExample.vb: CheckActive
Public Shared Sub CheckActive()
StoreSensorPanel()
Dim configuration As IConfiguration = Db4oFactory.NewConfiguration()
configuration.ActivationDepth(2)
Dim db As IObjectContainer = Db4oFactory.OpenFile _
(configuration, Db4oFileName)
Try
System.Console.WriteLine("Object container activation depth = 2")
Dim result As IObjectSet = db.QueryByExample(New SensorPanel(1))
Dim sensor As SensorPanel = CType(result(0), SensorPanel)
Dim NextSensor As SensorPanel = sensor.NextSensor
While Not NextSensor Is Nothing
System.Console.WriteLine("Object " + _
NextSensor.ToString() + " is active: " + _
db.Ext().IsActive(NextSensor).ToString())
NextSensor = NextSensor.NextSensor
End While
Finally
db.Close()
End Try
End Sub
This method can be useful in applications with deep object hierarchy if you prefer to use manual activation.
Download example code: