Howard
        If you need to do such logging you could check out the AOP approach.
In the .NET framework you could use the ContextBoundObject mechanism to
intercept and perform such custom actions(logging, security etc).

Cheers
Mahesh




-----Original Message-----
From: Howard Dierking [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 2:42 AM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Need to Append a line to an existing method


I'm working on creating a transparent auditing system whereby methods can be
flagged for auditing using attributes and the system, implemented in the
object or the object base class can process audit information.

The approach that I've taken thusfar is to create a custom attribute
(basically data only), and create a base class that goes through the type
information to determine which methods are flagged for auditing.

My thought at this point is to, when a method is found that requires
auditing,  append a line of code to that method (calling a _WriteAudit_
method) and immediately recompile.  In the Reflection.Emit namespace, I can
see how I could build methods from scratch -- however, I don't see how to
edit a method.

Also, concerned about the performance implications of this approach --
especially if there is a more standard approach for accomplishing my
aforementioned goal.  thoughts?

_howard

Reply via email to