Skip to main content
All docs
V25.2
  • BaseObject.OnCreated() Method

    Partially implements the IXafEntityObject interface in the BaseObject class.

    Namespace: DevExpress.Persistent.BaseImpl.EF

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

    NuGet Package: DevExpress.Persistent.BaseImpl.EFCore

    Declaration

    public virtual void OnCreated()

    Remarks

    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;
        }
    }
    

    The following code snippets (auto-collected from DevExpress Examples) contain references to the OnCreated() method.

    Note

    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.

    Implements

    See Also