Audit of save of persistent object

2 posts, 0 answers
  1. Grant Drury-Green
    Grant Drury-Green avatar
    23 posts
    Member since:
    Jul 2009

    Posted 05 Jul 2012 Link to this post

    I have a requirement to audit changes to persistent objects. I have tried to use [database context].Events.Changed but the event seems to be triggered for each property that is changed.

    I need to capture an event which aggregates any and all changes made to a persistent object. This can be either immediately before, or immediately after it has actually been written to the data store.

    Is there any current way to achieve this? Or can anyone suggest a possible method? I'm really trying to avoid DB triggers...
  2. Ady
    Ady avatar
    588 posts

    Posted 05 Jul 2012 Link to this post

    Hi Grant,

     You should consider using the 'OpenAccessContextBase.GetChanges()' method before SaveChanges. This will give you a consolidated list of changes that will be applied during SaveChanges.You can then call 'GetInsert/Updates/Deletes for a particular type to get further details.

    Do get back in case you need further assistance.

    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
  3. DevCraft banner
Back to Top