IExtObjectContainer.

GetID(Object) Method

Summary

returns the internal unique object ID.

Syntax

long GetID(Object obj)

Remarks

returns the internal unique object ID.

db4o assigns an internal ID to every object that is stored. IDs are guaranteed to be unique within one ObjectContainer. An object carries the same ID in every db4o session. Internal IDs can be used to look up objects with the very fast Db4objects.Db4o.Ext.IExtObjectContainer.GetByID(System.Int64) method.

Internal IDs will change when a database is defragmented. Use Db4objects.Db4o.Ext.IExtObjectContainer.GetObjectInfo(System.Object) , Db4objects.Db4o.Ext.IObjectInfo.GetUUID and Db4objects.Db4o.Ext.IExtObjectContainer.GetByUUID(Db4objects.Db4o.Ext.Db4oUUID) for long-term external references to objects.

Parameters

Name Type Description
obj Object any object

Return Value

Type Description
long the associated internal ID or
0
, if the passed object is not stored in this ObjectContainer.