abmv abmv - 1 year ago 147
C# Question

Implementing Audit Trail for Objects in C#?

I'm looking for ideas on how to implement audit trails for my objects in C#, for the current project,basically I need to:

1.Store the old values and new values of a given object.
2.Record creation of new objects.
3.Deletion of old object.

Is there any generic way of doing this,like using C# Generics,so that I don't have to write code for events of the base object like on creation,on deletion etc.(ORM objects).The thing is that if there was a way to inject audit trail if one is using a .Anybody have any experiences or any methods they follow.Any way to do this in a Aspect-oriented (AOP) mannner.

Please share your ideas etc.

Answer Source

Question is pretty similar to http://stackoverflow.com/questions/148291/how-do-you-implement-audit-trail-for-your-objects-programming

We've implemented a similar solution, using AOP (aspectJ implementation). Using this particular points can be captured and specific operations can be performed.

This can be plugged in and plugged off when we like.

However, our implementation was in J2EE..

If you really want to do it in the app layer, i would suggest this.

Hope it helps..