NHibernate version: 1.0.2
To get access to the list of columns being updated/inserted by NHibernate (with or without have dynamicinsert/update settings) for an entity, I should be looking into the OnFlushDirty Interceptor.
Please let me know if there is a better implementation exists or if this technique is errorprone. I need to get that kind of access to implement following requirements:
Audit Requirements:
1. Configurable column level auditing:
Based on Table/Column configured, the audit implementation should transparently log: TableName, columnName, RowKey (assume its always one and int), User, DateTime, Value and optionally IsPinned and Notes (see section (2) to understand what is IsPinned and Notes).
So, for example: Table: X has column A,B,D,F and I are configured to be audited, there would be 3 log entries would be created when Row 1 is modified to update columns A, C, D, I, G and H. Because A/D/I were auditable and others weren't.
2. Ability to Pin a value in row of table and still be able to track who attempted to change it:
This one is tricky, so we want that user can pin one/more value(s) in a row. Values saved over the pin values would be audited but not saved to the actual table/row/column. The pin value can be changed in two cases when a new values is Pinned or when someone cancels the pin.
Example: Column B in Row (1001) in Table X, has a pinned value 23. The audit log would read like this:
TableName: X, ColumnName: B, RowKey=1001, Value=23, User=John, DateTime=1/1/2006, IsPinned=true, Notes=Nagotiated by customer.
All next attempts to change this value would be logged but in Table X, Row 1001, Column B would always read 23.
|