For built-in db4o collections:
c#: IDb4oCollection.ActivationDepth(activationDepth)
VB: IDb4oCollection.ActivationDepth(activationDepth)
configures the activation depth for the objects returned from this collection. Default activation depth value for collections is 1, for hashmaps - 2.
01public static void TestCollectionDef() 02
{ 03
StoreCollection(); 04
IObjectContainer db = Db4oFactory.OpenFile(YapFileName); 05
db.Ext().Configure().ActivationDepth(5); 06
try 07
{ 08
IObjectSet result = db.Get(typeof(IList)); 09
ListResult(result); 10
IDb4oList list = (IDb4oList)result[0]; 11
for (int i = 0; i < list.Count; i++) 12
{ 13
Console.WriteLine("List element: " + list[i]); 14
} 15
} 16
finally 17
{ 18
db.Close(); 19
} 20
}
01Public Shared Sub TestCollectionDef() 02
StoreCollection() 03
Dim db As IObjectContainer = Db4oFactory.OpenFile(YapFileName) 04
db.Ext().Configure().ActivationDepth(5) 05
Try 06
Dim result As IObjectSet = db.Get(GetType(IList)) 07
ListResult(result) 08
Dim list As IDb4oList = CType(result(0), IDb4oList) 09
Dim i As Integer 10
For i = 0 To list.Count - 1 Step i + 1 11
Console.WriteLine("List element: " + list(i).ToString()) 12
Next 13
Finally 14
db.Close() 15
End Try 16
End Sub
Let's change the activation depth:
01public static void TestCollectionActivation() 02
{ 03
StoreCollection(); 04
IObjectContainer db = Db4oFactory.OpenFile(YapFileName); 05
db.Ext().Configure().ActivationDepth(0); 06
try 07
{ 08
IObjectSet result = db.Get(typeof(IList)); 09
ListResult(result); 10
11
IDb4oList list = (IDb4oList)result[0]; 12
Console.WriteLine("Setting list activation depth to 0 "); 13
list.ActivationDepth(0); 14
for (int i = 0; i < list.Count; i++) 15
{ 16
Console.WriteLine("List element: " + list[i]); 17
} 18
} 19
finally 20
{ 21
db.Close(); 22
} 23
}
01Public Shared Sub TestCollectionActivation() 02
StoreCollection() 03
Dim db As IObjectContainer = Db4oFactory.OpenFile(YapFileName) 04
db.Ext().Configure().ActivationDepth(0) 05
Try 06
Dim result As IObjectSet = db.Get(GetType(IList)) 07
ListResult(result) 08
09
Dim list As IDb4oList = CType(result(0), IDb4oList) 10
Console.WriteLine("Setting list activation depth to 0 ") 11
list.ActivationDepth(0) 12
Dim i As Integer 13
For i = 0 To list.Count - 1 Step i + 1 14
Console.WriteLine("List element: " + list(i).ToString()) 15
Next 16
Finally 17
db.Close() 18
End Try 19
End Sub
Specify a value less than zero to use the default activation depth configured for the ObjectContainer or for individual objects.