You are here: Configuration > File Configuration > Generate UUIDs

Generate UUIDs

db4o can generate UUIDs for each stored object. These UUIDs are mainly used for replication together with commit timestamps. Of course it can be used also for other purposes.

Enable UUIDs for all objects.

You can enable UUIDs for all objects. Set the global scope on the UUID setting.

IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
configuration.File.GenerateUUIDs = ConfigScope.Globally;
FileConfiguration.cs: Enable db4o uuids globally
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration()
configuration.File.GenerateUUIDs = ConfigScope.Globally
FileConfiguration.vb: Enable db4o uuids globally

Enable UUIDs for certain classes

You can also enable uuids only for certain classes:

IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
configuration.File.GenerateUUIDs = ConfigScope.Individually;
configuration.Common.ObjectClass(typeof (SpecialClass)).GenerateUUIDs(true);
FileConfiguration.cs: Enable db4o uuids for certain classes
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration()
configuration.File.GenerateUUIDs = ConfigScope.Individually
configuration.Common.ObjectClass(GetType(SpecialClass)).GenerateUUIDs(True)
FileConfiguration.vb: Enable db4o uuids for certain classes