AuditTrailServiceBase.BeginObjectsAudit(Session, Object[]) Method
Starts auditing the specified objects in Full object auditing mode.
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 to be audited. |
alreadyLoadedObjects | Object[] | Objects to be audited. |
Remarks
AuditTrailViewController calls this method internally.
The following code demonstrates how to use this method:
using DevExpress.ExpressApp;
using DevExpress.Persistent.AuditTrail;
using DevExpress.Xpo;
using Microsoft.Extensions.DependencyInjection;
// ...
var auditTrailService = serviceProvider.GetRequiredService<AuditTrailService>();
UnitOfWork 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, nestedUow.GetParentObject(obj));
uow.CommitChanges();
auditTrailService.SaveAuditData(uow);
See Also