c#:
configuration.ActivationDepth(activationDepth)
VB:
configuration.ActivationDepth(activationDepth)
configures global activation depth, which will be used for all objects instead of the default value. This method should be called before opening a database file.
c#:
configuration.ActivationDepth(activationDepth)
VB:
configuration.ActivationDepth(activationDepth)
has a similar effect, but the setting will be applied to the specific ObjectContainer and can be changed for the open database file.
01private static void TestActivationConfig() 02
{ 03
StoreSensorPanel(); 04
IConfiguration configuration = Db4oFactory.NewConfiguration(); 05
configuration.ActivationDepth(1); 06
IObjectContainer db = Db4oFactory.OpenFile(configuration, Db4oFileName); 07
try 08
{ 09
Console.WriteLine("Object container activation depth = 1"); 10
IObjectSet result = db.Get(new SensorPanel(1)); 11
ListResult(result); 12
if (result.Count >0) 13
{ 14
SensorPanel sensor = (SensorPanel)result[0]; 15
SensorPanel next = sensor.Next; 16
while (next != null) 17
{ 18
Console.WriteLine(next); 19
next = next.Next; 20
} 21
} 22
} 23
finally 24
{ 25
db.Close(); 26
} 27
}
01Private Shared Sub TestActivationConfig() 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
Console.WriteLine("Object container activation depth = 1") 08
Dim result As IObjectSet = db.Get(New SensorPanel(1)) 09
ListResult(result) 10
If result.Count > 0 Then 11
Dim sensor As SensorPanel = CType(result(0), SensorPanel) 12
Dim nextSensor As SensorPanel = sensor.NextSensor 13
While Not nextSensor Is Nothing 14
Console.WriteLine(nextSensor) 15
nextSensor = nextSensor.NextSensor 16
End While 17
End If 18
Finally 19
db.Close() 20
End Try 21
End Sub
By configuring db4o you can have full control over activation behavior. The two extremes: