AuditTrailServiceBase.BeginObjectsAudit(Session, ObjectAuditingMode, Object[]) Method
Starts auditing the specified objects according to auditingMode.
Namespace: DevExpress.Persistent.BaseImpl.AuditTrail.Services
Assembly: DevExpress.Persistent.BaseImpl.Xpo.v24.2.dll
NuGet Package: DevExpress.Persistent.BaseImpl.Xpo
Declaration
Parameters
Name | Type | Description |
---|---|---|
session | Session | The Session object. |
auditingMode | DevExpress.Persistent.AuditTrail.ObjectAuditingMode | The ObjectAuditingMode value that is the object auditing mode. The default value is Full. |
alreadyLoadedObjects | Object[] | Objects to be audited. |
Remarks
Call this method in non-XAF applications only. The following code demonstrates how to do this:
using DevExpress.ExpressApp;
using DevExpress.Persistent.AuditTrail;
using DevExpress.Xpo;
using Microsoft.Extensions.DependencyInjection;
// ...
var auditTrailService = serviceProvider.GetRequiredService<AuditTrailService>();
using var uow = new UnitOfWork(serviceProvider);
auditTrailService.BeginSessionAudit(uow, AuditTrailStrategy.OnObjectChanged, ObjectAuditingMode.Full);
NestedUnitOfWork nestedUow = uow.BeginNestedUnitOfWork();
PersistentObject1 obj = new PersistentObject1(nestedUow);
obj.Property1 = "1";
obj.Property2 = "2";
nestedUow.CommitChanges();
auditTrailService.BeginObjectsAudit(uow, ObjectAuditingMode.Lightweight, nestedUow.GetParentObject(obj));
uow.CommitChanges();
auditTrailService.SaveAuditData(uow);
See Also