IConfiguration.

ActivationDepth(int) Method

Summary

sets the activation depth to the specified value. gets the configured activation depth.

Syntax

void ActivationDepth(int depth)

Remarks

sets the activation depth to the specified value.

Why activation?
When objects are instantiated from the database, the instantiation of member objects needs to be limited to a certain depth. Otherwise a single object could lead to loading the complete database into memory, if all objects where reachable from a single root object.

db4o uses the concept "depth", the number of field-to-field hops an object is away from another object. The preconfigured "activation depth" db4o uses in the default setting is 5.

Whenever an application iterates through the Db4objects.Db4o.IObjectSet of a query result, the result objects will be activated to the configured activation depth.

A concrete example with the preconfigured activation depth of 5:
    // Object foo is the result of a query, it is delivered by the ObjectSet
    object foo = objectSet.Next();
foo.member1.member2.member3.member4.member5 will be a valid object
foo, member1, member2, member3 and member4 will be activated
member5 will be deactivated, all of it's members will be null
member5 can be activated at any time by calling Db4objects.Db4o.IObjectContainer.Activate(System.Object,System.Int32) .

Note that raising the global activation depth will consume more memory and have negative effects on the performance of first-time retrievals. Lowering the global activation depth needs more individual activation work but can increase performance of queries.

Db4objects.Db4o.IObjectContainer.Deactivate(System.Object,System.Int32) can be used to manually free memory by deactivating objects.

In client/server environment the same setting should be used on both client and server

.

Parameters

Name Type Description
depth int the desired global activation depth.

Return Value

Type Description
void

See Also

  • Db4objects.Db4o.Config.IObjectClass.MaximumActivationDepth(System.Int32)