You are here: Configuration > Common Configuration > Update Depth

Update Depth

By default db4o only stores changes on the updated object but not the changes on referenced objects. With a higher update-depth db4o will traverse along the object graph to a certain depth and update all objects. See "Update Concept"

With the update-depth you configure how deep db4o updates the object-graph.

IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
configuration.Common.UpdateDepth = 2;
CommonConfigurationExamples.cs: Increasing the update-depth
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration()
configuration.Common.UpdateDepth = 2
CommonConfigurationExamples.vb: Increasing the update-depth

A higher update depth is usually more convenient, because you don't need to explicitly store each changed object. However the higher the update depth is the more time it takes to update the objects. Therefore it is a tradeoff. Note that you can also use transparent persistence, which takes of updating the right objects.

Class Specific Configuration

You can also configure a class specific update depth. See "Class Specific Configuration"

IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
configuration.Common.ObjectClass(typeof (Person)).UpdateDepth(2);
ObjectConfigurationExamples.cs: Set the update depth
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration()
configuration.Common.ObjectClass(GetType(Person)).UpdateDepth(2)
ObjectConfigurationExamples.vb: Set the update depth