Skip to main content
All docs
V24.1
.NET Framework 4.5.2+

AuditTrailServiceBase.IsSessionAudited(Session) Method

Indicates whether the Audit Trail Module audits object changes within the specified session.

Namespace: DevExpress.Persistent.BaseImpl.AuditTrail.Services

Assembly: DevExpress.Persistent.BaseImpl.Xpo.v24.1.dll

Declaration

public bool IsSessionAudited(
    Session session
)

Parameters

Name Type Description
session Session

The Session object that this method checks.

Returns

Type Description
Boolean

true if the Audit Trail Module audits object changes in the specified session; otherwise, false.

Remarks

The following code sample demonstrates how to use this method:

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Xpo;
using DevExpress.Persistent.AuditTrail;
using DevExpress.Xpo;
using Microsoft.Extensions.DependencyInjection;

public partial class MyController : ViewController {
    protected override void OnActivated() {
        base.OnActivated();
        Session session = ((XPObjectSpace)ObjectSpace).Session;
        var auditTrailService = Application.ServiceProvider.GetRequiredService<AuditTrailService>();
        if(auditTrailService.IsSessionAudited(session)) {
            auditTrailService.BeginSessionAudit(session,
            AuditTrailStrategy.OnObjectChanged, ObjectAuditingMode.Full);
        }
    }
    // ...
}
See Also