Skip to main content
.NET 6.0+

BaseObjectSpace.NonPersistentChangesEnabled Property

Specifies whether the BaseObjectSpace is marked as modified (see BaseObjectSpace.IsModified) when a non-persistent property is changed.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v23.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public bool NonPersistentChangesEnabled { get; set; }

Property Value

Type Description
Boolean

true, to mark the Object Space as modified when a non-persistent property is changed; otherwise, false. The default is false.

Remarks

To set this property for all Object Spaces created by the application, handle the XafApplication.ObjectSpaceCreated event.

XAF Windows Forms Application - Program.cs (Program.vb) file:

public class Program {
    //...
    public static void Main(string[] arguments) {
        //...
        winApplication.Setup();
        winApplication.ObjectSpaceCreated += winApplication_ObjectSpaceCreated;
        winApplication.Start();
        //...
    }
    static void winApplication_ObjectSpaceCreated(object sender, ObjectSpaceCreatedEventArgs e) {
        BaseObjectSpace os = e.ObjectSpace as BaseObjectSpace;
        if (os != null)
            os.NonPersistentChangesEnabled = true;
    }
}

XAF ASP.NET Web Forms Application - Global.asax.cs (Global.asax.vb) file:

public class Global : System.Web.HttpApplication {
    //...
    protected void Session_Start(object sender, EventArgs e) {
        WebApplication.SetInstance(Session, new MySolutionWebApplication());
        WebApplication.Instance.ObjectSpaceCreated += Instance_ObjectSpaceCreated
        //...
        WebApplication.Instance.Setup();
        WebApplication.Instance.Start();
    }
    void Instance_ObjectSpaceCreated(object sender, ObjectSpaceCreatedEventArgs e) {
        BaseObjectSpace os = e.ObjectSpace as BaseObjectSpace;
        if (os != null)
            os.NonPersistentChangesEnabled = true;
    }
}
See Also