Skip to main content
.NET Framework 4.5.2+

XPBaseObject Class

Serves as a base for classes that represent persistent objects.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.1.dll

NuGet Package: DevExpress.Xpo


public abstract class XPBaseObject :


The XPBaseObject class automatically supports the optimistic concurrency feature. If this feature is not required, you can use the XPLiteObject class instead.

When creating a persistent object by deriving from the XPBaseObject, XPCustomObject or XPObject class, an OptimisticLockingAttribute is automatically applied to it. This attribute specifies whether a session can lock a persistent object’s state (allows optimistic locking to be enabled). For more information, see XPObject and Optimistic Concurrency.

The following code demonstrates how to declare a persistent object.

using DevExpress.Xpo;
using System.ComponentModel;

// Other base classes:

public class MyClass : XPBaseObject {
    public MyClass(Session session) : base(session) { }
    // XPBaseObject does not have a built-in key and you need to add your own key
    [Key(AutoGenerate = true), Browsable(false)]
    public int Oid { get; set; }
    string fMyProperty;
    public string MyProperty {
        get { return fMyProperty; }
        set { SetPropertyValue(nameof(MyProperty), ref fMyProperty, value); }
See Also