Some settings are field-specific. It's part of the object-configuration, which is available on the client, server and embedded-mode of db4o.
Its recommended that you use the same configuration for the client and the server.
The configuration for a field follows the same pattern. First you specify for which type this configuration applies. You pass the type or the name as string. Then you navigate to the specific field by passing the field name as string.
Note that you need to specify the field-name and not the property-name, also for auto-properties.
Index dramatically speed up queries. You should index all fields which you run queries on. See "Indexing"
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.Common.ObjectClass(typeof (Person)).ObjectField("name").Indexed(true);
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.Common.ObjectClass(GetType(Person)).ObjectField("name").Indexed(True)
As an alternative you also can use the appropriate Attribute on the field which you want to index.
[Indexed] private string zipCode;
<Indexed()> _ Private m_zipCode As String
db4o uses the concept of activation to avoid loading to much data into memory. When this setting is turned on, the object referenced by this field is activated, when the object is activated.
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.Common.ObjectClass(typeof (Person)).ObjectField("father").CascadeOnActivate(true);
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.Common.ObjectClass(GetType(Person)).ObjectField("father").CascadeOnActivate(True)
When the object is updated, the object referenced by this field is also updated.
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.Common.ObjectClass(typeof (Person)).ObjectField("father").CascadeOnUpdate(true);
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.Common.ObjectClass(GetType(Person)).ObjectField("father").CascadeOnUpdate(True)
When the object is deleted, the object referenced by this field is also deleted
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.Common.ObjectClass(typeof (Person)).ObjectField("father").CascadeOnDelete(true);
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.Common.ObjectClass(GetType(Person)).ObjectField("father").CascadeOnDelete(True)
Allows you to rename this field. . See "Refactoring and Schema Evolution"
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.Common.ObjectClass(typeof (Person)).ObjectField("name").Rename("sirname");
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.Common.ObjectClass(GetType(Person)).ObjectField("name").Rename("sirname")