All docs
V20.2
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Audit Specific Operations

  • 3 minutes to read

You can instruct Audit Trail Module not to log particular operations. Handle the CustomizeAuditOperationTypeFilter event, check the current operation type, and set the SaveAuditOperation argument to false. The following example shows how to exclude the ObjectChanged and ObjectCreated records from the audit log.

In a Cross-Platform Module

File: MySolution.Module\MySolutionModule.cs (MySolutionModule.vb).

using DevExpress.Persistent.AuditTrail;
using static DevExpress.Persistent.AuditTrail.AuditTrailService;
// ...
public sealed partial class MySolutionModule : ModuleBase { 
    public override void Setup(XafApplication application) {
        base.Setup(application); 
        AuditTrailService.Instance.CustomizeAuditOperationTypeFilter += 
            new EventHandler<CustomAuditOperationTypeFilterEventArgs>(Instance_CustomizeAuditOperationTypeFilter);  
        //...  
    }  
    private static void Instance_CustomizeAuditOperationTypeFilter(object sender, CustomAuditOperationTypeFilterEventArgs e) {  
        if(e.AuditOperationType == AuditOperationType.ObjectChanged || 
            e.AuditOperationType == AuditOperationType.ObjectCreated) {
            e.SaveAuditOperation = false;
        }
    }
    // ...
}  

In a WinForms Application

File: Program.cs (Program.vb).

using DevExpress.Persistent.AuditTrail;
using static DevExpress.Persistent.AuditTrail.AuditTrailService;
// ...
public class Program {  
    public static void Main() {  
        //...  
        MySolutionWinApplication winApplication = new MySolutionWinApplication();  
        AuditTrailService.Instance.CustomizeAuditOperationTypeFilter += 
            new EventHandler<CustomAuditOperationTypeFilterEventArgs>(Instance_CustomizeAuditOperationTypeFilter);  
        //...  
    }  
    private static void Instance_CustomizeAuditOperationTypeFilter(object sender, CustomAuditOperationTypeFilterEventArgs e) {  
        if(e.AuditOperationType == AuditOperationType.ObjectChanged || 
            e.AuditOperationType == AuditOperationType.ObjectCreated) {
            e.SaveAuditOperation = false;
        }
    }
    // ...
}  

In an ASP.NET Application

File: Global.asax.cs (Global.asax.vb).

using DevExpress.Persistent.AuditTrail;
using static DevExpress.Persistent.AuditTrail.AuditTrailService;
// ...
public class Global : System.Web.HttpApplication {
    protected void Session_Start(object sender, EventArgs e) {
        //...  
        WebApplication.SetInstance(Session, new MySolutionWebApplication());  
        AuditTrailService.Instance.CustomizeAuditOperationTypeFilter += 
            new EventHandler<CustomAuditOperationTypeFilterEventArgs>(Instance_CustomizeAuditOperationTypeFilter);  
        //...  
    }  
    private static void Instance_CustomizeAuditOperationTypeFilter(object sender, CustomAuditOperationTypeFilterEventArgs e) {  
        if(e.AuditOperationType == AuditOperationType.ObjectChanged || 
            e.AuditOperationType == AuditOperationType.ObjectCreated) {
            e.SaveAuditOperation = false;
        }
    }
    // ...
} 

In a Blazor Application

File: Program.cs.

using DevExpress.Persistent.AuditTrail;
using static DevExpress.Persistent.AuditTrail.AuditTrailService;
// ...
public class Program {  
    public static void Main() {  
        //...    
        AuditTrailService.Instance.CustomizeAuditOperationTypeFilter += 
            new EventHandler<CustomAuditOperationTypeFilterEventArgs>(Instance_CustomizeAuditOperationTypeFilter);  
        CreateHostBuilder(args).Build().Run();
    }  
    private static void Instance_CustomizeAuditOperationTypeFilter(object sender, CustomAuditOperationTypeFilterEventArgs e) {  
        if(e.AuditOperationType == AuditOperationType.ObjectChanged || 
            e.AuditOperationType == AuditOperationType.ObjectCreated) {
            e.SaveAuditOperation = false;
        }
    }
    // ...
}