Back to Devexpress

XPLiteObject Class

xpo-devexpress-dot-xpo-afc7b124.md

latest3.6 KB
Original Source

XPLiteObject Class

Implements the IXPObject.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
[NonPersistent]
[MemberDesignTimeVisibility(false)]
[OptimisticLocking(false)]
public abstract class XPLiteObject :
    XPBaseObject
vb
<NonPersistent>
<MemberDesignTimeVisibility(False)>
<OptimisticLocking(False)>
Public MustInherit Class XPLiteObject
    Inherits XPBaseObject

Remarks

When declaring a persistent object, you can use the XPLiteObject class as an anscestor for the object if the optimistic concurrency feature is not required. Otherwise, use the XPBaseObject class.

If your persistent class derives from the XPLiteObject class, the OptimisticLockingAttribute isn’t applied. In this instance, you should manually apply this attribute to support optimistic locking. This can be useful when it is needed to map to existing databases.

The following code demonstrates how to declare a persistent object.

csharp
using DevExpress.Xpo;
using System.ComponentModel;

// Other base classes: https://docs.devexpress.com/eXpressAppFramework/113146/concepts/business-model-design/business-model-design-with-xpo/base-persistent-classes

public class MyClass : XPLiteObject {
    public MyClass(Session session) : base(session) { }
    // XPLiteObject 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); }
    }
}
vb
Imports System.ComponentModel
Imports DevExpress.Xpo

' Other base classes: https://docs.devexpress.com/eXpressAppFramework/113146/concepts/business-model-design/business-model-design-with-xpo/base-persistent-classes

Public Class [MyClass]
    Inherits XPLiteObject
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    ' XPLiteObject does not have a built-in key and you need to add your own key
    <Key(AutoGenerate:=True)>
    <Browsable(False)>
    Public Property Oid() As Integer
    Private fMyProperty As String
    Public Property MyProperty() As String
        Get
            Return fMyProperty
        End Get
        Set(ByVal value As String)
            SetPropertyValue(NameOf(MyProperty), fMyProperty, value)
        End Set
    End Property
End Class

Implements

IXPObject

IXPSimpleObject

ISessionProvider

IXPModificationsStore

Inheritance

Object PersistentBase XPBaseObject XPLiteObject

See Also

XPLiteObject Members

XPO Classes Comparison

DevExpress.Xpo Namespace