This project is read-only.

Auditing - Error after adding field [NHDAL]

Aug 10, 2011 at 10:25 PM

I have an entity that has auditing turned on..  It also has records in it (the audit table).  I then add a boolean field to the entity, Not NULL default 0.

When I then do a GetAuditRecords() against the entity I get the following error [Because their are records in the audit table now that have the value in that field as NULL]

"Data is Null. This method or property cannot be called on Null values."

It happens when the newly generated code attempts to call dataReader.GetBoolean(ordinal) on the field in question.


Aug 13, 2011 at 2:43 AM

The newest version has a fix for this. All fields in the audit table are nullable. I am sorry but you will need to set all fields to nullable in your database manually. When you re-generate everything should work fine. The generation of a new audit table wills work properly but existing ones like yours needs to be fixed manually.