public AuditTrigger(Table dataTable, AuditTable auditTable, INamingStrategy namingStrategy, TriggerActions action) : base(namingStrategy.GetTriggerName(dataTable, action), dataTable.GetQuotedName(), action) { _auditTableName = auditTable.GetTable().Name; _dataColumnNames = ( from column in dataTable.ColumnIterator select column.GetQuotedName() ).ToArray(); _auditColumns = ( from column in auditTable.GetTable().ColumnIterator where column is AuditColumn select column as AuditColumn ).ToArray(); }
private void AddAuditing(Mappings mappings) { var auditObjects = new List<IAuxiliaryDatabaseObject>(); foreach (var table in mappings.IterateTables.ToArray()) { var auditTable = new AuditTable( table, _namingStrategy, _columnSource); mappings.AddAuxiliaryDatabaseObject(auditTable); var insertTrigger = new AuditTrigger(table, auditTable, _namingStrategy, TriggerActions.INSERT); mappings.AddAuxiliaryDatabaseObject(insertTrigger); var updateTrigger = new AuditTrigger(table, auditTable, _namingStrategy, TriggerActions.UPDATE); mappings.AddAuxiliaryDatabaseObject(updateTrigger); var deleteTrigger = new AuditTrigger(table, auditTable, _namingStrategy, TriggerActions.DELETE); mappings.AddAuxiliaryDatabaseObject(deleteTrigger); } }