Specifies the persistent object’s identifier.
NuGet Package: DevExpress.Persistent.BaseImpl.Xpo
A globally unique identifier which represents the persistent object’s identifier.
To distinguish between different business objects and correctly identify them, the BaseObject class exposes the Oid property. This is an auto-generated property, meaning you do not need to assign identifier values for each persistent object. The Oid property can also be referred to as a primary key property, since it is represented by a primary key in the database.
Note that when OidInitializationMode is set to OnSaving, new persistent objects have Guid.Empty as the Oid property value after they are created. The property gains a final value after the object is saved to the database.
The XPObjectSpace class exposes a number of methods that take the value returned by a business object’s Oid property as a parameter. These methods allow you to find a particular object by its key property value, as well as perform additional actions based on it. The following table lists these methods.
The BaseObject‘s Oid property, as well as other base classes key properties, is not designed to be manually set. In fact, this is not supported and should never be done. Under normal circumstances, the Oid property does not even expose a setter.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Oid property.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.