This project is read-only.

Inheritance and Auditing together

Aug 19, 2010 at 2:36 PM

Just wondering, when you use table inheritance and auditing together do the audit select commands bring back the inheritance graph or just the columns for the table queried?
For example, if you have an EMPLOYEE table that has a PARTY table as a parent, and you ask for the audit results for one of the EMPLOYEE rows, do you get back the columns for the EMPLOYEE table or the columns for both the EMPLOYEE table and the associated parent PARTY table row in the audit query results?

Aug 20, 2010 at 12:49 AM

Firstly, let me say that I am extremely impressed with the built in functionality of nHydrate and I know how hard and time consuming it is to compile Help documentation.

I have just run a little console app to test my question.
The result is, if you execute an Employee.GetAuditRecords() then only the EMPLOYEE table columns are returned. The parent PARTY table's columns are not returned.
I was hoping that the columns for both tables were returned in the collection of Employee audit items.  Because if I am displaying a gridview in the UI populated with Employees and I have an adminstrator function attached to a button click event to return audit items for the selected row I would have liked to be able to display the combined set of columns to match the UI display of Employees.
Is this possible with a single GetAuditRecords() method or do you have to do two calls (Employee and Party) and build an in-memory result set to match the displayed Employee rows?  I guess you would have to have relationships established for the Audit tables for this sort of functionality.  The problem goes away of course if you do not use Inheritance.

Aug 25, 2010 at 3:02 AM

At this time there is no way to get all field for an entire inheritance heirarchy across all tables. You can only get the fields for the actual table that holds a set of fields. For example if you have a User and Customer derives from it then the table audit from the User object will have all fields for user but the audit from Customer will only have the fields physically located in the Customer database table. This is a limitation at this time.