Skip to main content
All docs
V24.2
.NET 8.0+
  • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BaseObject.OnLoaded() Method

Partially implements the IXafEntityObject interface in the BaseObject class.

Namespace: DevExpress.Persistent.BaseImpl.EF

Assembly: DevExpress.Persistent.BaseImpl.EFCore.v24.2.dll

NuGet Package: DevExpress.Persistent.BaseImpl.EFCore

#Declaration

public virtual void OnLoaded()

#Remarks

C#
using DevExpress.Data.Filtering;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl.EF;

namespace YourSolutionName.Module.BusinessObjects;

[DefaultClassOptions]
public class MyPersistentClass : BaseObject {
    public virtual string Name { get; set; }
    public virtual bool IsNew { get; set; }
    public virtual ApplicationUser CreatedBy { get; set; }
    public virtual ApplicationUser LastModifiedBy { get; set; }
    ApplicationUser GetCurrentUser() {
        return ObjectSpace.FindObject<ApplicationUser>(CriteriaOperator.Parse("ID=CurrentUserId()"));
    }
    public override void OnCreated() {
        CreatedBy = GetCurrentUser();
        IsNew = true;
    }
    public override void OnLoaded() {
        IsNew = false;
    }
    public override void OnSaving() {
        if(ObjectSpace != null) {
            LastModifiedBy = GetCurrentUser();
        }
        IsNew = false;
    }
}

#Implements

See Also