Auditing - created_by and modified_by on delete

Jul 28, 2010 at 4:39 PM
Edited Jul 28, 2010 at 4:48 PM
I have two issues.
  1. created_by field is not getting set.
  2. modified_by is not getting set on delete

Example:
  • Table:
    • tblPerson
  • Behavior:
    • AllowAuditTracking
    • AllowCreateAudit
    • AllowModifiedAudit
  • Columns:
    • personID (PK)
    • firstName
    • lastName
    • created_by (created by AllowCreateAudit)
    • created_date (created by AllowCreateAudit)
    • modified_by (created by AllowModifiedAudit)
    • modified_date ((created by AllowModifiedAudit)
1)
   Dim personCollectionObj as PersonCollection = new PersonCollection("newPersonCreationTest")
   Dim personObj as Person = personCollectionObj .newItem()
   personObj.firstName = "Test"
   personObj.lastName = "Person"
   personCollectionObj .addItem(personObj)
   personCollectionObj .persist()

   *This above code will insert a created_date into the record but the created_by will be NULL. The _AUDIT_tblPerson table will get a created record entry

2)
   Dim personObj as Person = Person.SelectUsingPK(somePersonsId, "deletePersonTest")
   personObj.delete()
   personObj.persist()

   *The modified_by field is NULL in the deleted record entry of _AUDIT_tblPerson.

   Any help would be greatly appreciated. Thanks
Coordinator
Jul 28, 2010 at 7:27 PM

You are correct. There was a small change in object initialization last week that caused this issue. It will be fixed in tonight's build. There will be a release tonight to address some EF Beta issues, so this change will be in it too.

Jul 28, 2010 at 7:34 PM
Thank you
Jul 28, 2010 at 8:29 PM
One other question. Looks like an audit class is not created for tables that have their associative property set to true. Is this always the case?
Coordinator
Jul 29, 2010 at 5:04 AM

You should be able to use the audit fields with associative tables with the newly posted version 170 using the NHDAL.