New Posts New Posts RSS Feed: Recommendations for Audit Trial
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Recommendations for Audit Trial

 Post Reply Post Reply
Author
sebma View Drop Down
Groupie
Groupie
Avatar

Joined: 19-Aug-2008
Location: Singapore
Posts: 66
Post Options Post Options   Quote sebma Quote  Post ReplyReply Direct Link To This Post Topic: Recommendations for Audit Trial
    Posted: 22-Sep-2008 at 2:06am
I was reading discussion topic on object cloning (http://www.ideablade.com/forum/forum_posts.asp?TID=874), and would like to know a good recommendation on implementing Audit Trial for DevForce EF objects. The DevForce EF Developers Guide is kind of brief. Should I just implement a 1-to-Many for each table that need audit trial, as in a table has a 1-to-Many relationship to another table which stores the historical trial. Is there any methods I need to implement or override such that audit trial is created when object is changed or deleted?

Thanks all in advance.
-Sebastian

Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 22-Sep-2008 at 3:24pm
There are many ways to do auditing, and people have many different auditing needs. Most of the topic is not at all specific to DevForce.  However, it is often advantageous to create audit records server-side, and for that the IEntityServerSaving and IEntityServerSaved interfaces are your keys to a very useful DevForce facility.[1]
 
If you provide a server-side class that implements IEntityServerSaving, it will get called whenever entities are submitted for a save. An OnSaving() method mandated by the interface gets an EntityManager that contains the entities being saved.  You could create audit records for any or all of them and add those audit records to the EntityManager that will be submitted for saving.  The base records and audit records would all be part of the same transaction.
 
You would probably want to remove the audit records from the set of records returned to the client, and you could do that in the OnSaved() method of your IEntityServerSaved implementation. It gets an EntityManager containing the records that were saved. 
 
Greg Dunn
 
 
 
 
 
-------------------------
[1] There are also client-side Saving and Saved events that could be handled if for some reason you wanted to create audit records client-side.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down