public override int SaveChanges(bool acceptAllChangesOnSuccess) { ProccessChangeTrackerResult proccessChangeTrackerResult = ChangeTrackerAuditService.ProccessChangeTracker(ChangeTracker, _auditOptions); AuditSubjectData auditSubjectData = _auditSubjectDataService.Get(); IEnumerable <AuditEntity> auditEntities = proccessChangeTrackerResult.AuditObjectData .Select(x => new AuditEntity( auditObjectData: x, auditSubjectData: auditSubjectData)); Audit.AddRange(auditEntities); return(base.SaveChanges()); }
public async override Task <int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default) { ProccessChangeTrackerResult proccessChangeTrackerResult = await ChangeTrackerAuditService.ProccessChangeTrackerAsync(ChangeTracker, _auditOptions); AuditSubjectData auditSubjectData = _auditSubjectDataService.Get(); IEnumerable <AuditEntity> auditEntities = proccessChangeTrackerResult.AuditObjectData .Select(x => new AuditEntity( auditObjectData: x, auditSubjectData: auditSubjectData)); Audit.AddRange(auditEntities); return(await base.SaveChangesAsync()); }