Breaking Change T1246233
Visible to All Users

Audit - Non Persistent Properties are Excluded from the Audit Log (XPO)

What Changed

All read-only properties (those without a set accessor) and properties decorated with the [NonPersistentAttribute] are automatically excluded from the audit trail in v24.1+.

Reasons for Change

Previously, values of all object properties, including non-persistent properties, were copied to the audit log (if you used the Audit Trail module with the FullObjectAuditProcessor). This behavior could be suboptimal due to the following reasons:

  • Since a property is not persistent itself and is typically not intended to be explicitly changed by a user, auditing its changes is unnecessary in most instances.
  • In certain instances, getters of non-persistent properties may involve "heavy" logic, such as accessing the database or loading large collections. Auditing such properties can result in a significant amount of unnecessary computation. The performance impact can be especially noticeable when you use the Scheduler Module with auditing enabled.

Impact on Existing Apps

From v24.1 onwards, non-persistent properties are excluded by default from the audit log.

How to Update Existing Apps

Set the DefaultSettingsCompatibilityMode static property to Latest, 24_1 or a later version.
Alternatively, set the static ObjectAuditProcessor.ExcludeNonPersistentFromAudit property to true:

Files:
Blazor - MySolution.Blazor.Server\Program.cs
WinForms - MySolution.Win\Program.cs
Web API - MySolution.WebApi\Program.cs
ASP.NET Web Forms - MySolution\MySolution.Web\Global.asax.cs

C#
public static int Main(string[] arguments) { DevExpress.Persistent.AuditTrail.ObjectAuditProcessor.ExcludeNonPersistentFromAudit=true; }

How to Revert to Previous Behavior

Use one of the following techniques to revert to the previous behavior:

  • Disable the new behavior globally.

    Files:
    Blazor - MySolution.Blazor.Server\Program.cs
    WinForms - MySolution.Win\Program.cs
    Web API - MySolution.WebApi\Program.cs
    ASP.NET Web Forms - MySolution\MySolution.Web\Global.asax.cs

    C#
    public static int Main(string[] arguments) { DevExpress.Persistent.AuditTrail.ObjectAuditProcessor.ExcludeNonPersistentFromAudit=false; }
  • Use [UseInAuditTrail(true)] to enable audit for a specific property. (the UseInAuditTrailAttribute takes precedence over the static ExcludeNonPersistentFromAudit property).

    C#
    [UseInAuditTrail(true)] [NonPersistent] public virtual string NonPersistentUseInAuditTrailTrue { get; set; }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.