You are here: Configuration > Class Specific Configuration > Persist Static Fields

Persist Static Fields

By default db4o doesn't store static fields. With this setting you force db4o to also store the value of the static fields. Note that only reference types are stored. Value-types like ints, longs etc are not persisted.

In general you shouldn't store static fields, because this can lead to unexpected behaviors. It's mostly useful for enumeration-classes. See "Storing Static Fields"

IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
configuration.Common.ObjectClass(typeof (Person)).PersistStaticFieldValues();
ObjectConfigurationExamples.cs: Persist also the static fields
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration()
configuration.Common.ObjectClass(GetType(Person)).PersistStaticFieldValues()
ObjectConfigurationExamples.vb: Persist also the static fields