/// <summary> /// Audits the entity. Override this method to adjust the audit record /// before it is submitted to the database or to prevent the audit. /// </summary> /// <param name="entity">The changed entity.</param> /// <param name="auditHistory">The audit history.</param> /// <param name="isNewEntry">if set to <c>true</c> add a new entry.</param> protected virtual void AuditEntity(T entity, DbAuditHistory auditHistory, bool isNewEntry) { // Ensure change log support has not been disabled if (!_isDbAuditHistoryEnabled) { return; } if (isNewEntry) { AuditHistoryAdapter?.InsertEntity(auditHistory); } else { AuditHistoryAdapter?.ReplaceEntity(auditHistory, auditHistory.GetUri()); } var dataObject = entity as IDataObject; if (dataObject != null) { var collection = dataObject.CreateCollection(); AuditHistoryAdapter?.QueueNotification(collection, auditHistory); } else { AuditHistoryAdapter?.QueueNotification(entity, auditHistory); } }
/// <summary> /// Audits the entity. Override this method to adjust the audit record /// before it is submitted to the database or to prevent the audit. /// </summary> /// <param name="entity">The changed entity.</param> /// <param name="auditHistory">The audit history.</param> /// <param name="isNewEntry">if set to <c>true</c> add a new entry.</param> protected virtual void AuditEntity(T entity, DbAuditHistory auditHistory, bool isNewEntry) { if (isNewEntry) { AuditHistoryAdapter?.InsertEntity(auditHistory); } else { AuditHistoryAdapter?.ReplaceEntity(auditHistory, auditHistory.GetUri()); } var dataObject = entity as IDataObject; if (dataObject != null) { var collection = dataObject.CreateCollection(); AuditHistoryAdapter?.QueueNotification(collection, auditHistory); } else { AuditHistoryAdapter?.QueueNotification(entity, auditHistory); } }