|
I normally keep it with Peter and don't re-post any articles without comment, but this time Richard just did it. There's nothing to add:
What if... you could take this piece of code:
public void Before( CallContext context ) { Console.WriteLine( "Method was called at: {0}", DateTime.Now ); }
and wrap it around a method within a piece of compiled code:
using System; public class Application { public static void Main() { /* ... do stuff ... */ } }
With a little assistance from this definition:
<weave> <aspect pointcut="Application.Main" adviceType="before" advice="MyAspect.Before" /> </weave>
Imagine the possibilities!
This is an approximate example of how one might use John Lam's aspect weaver, CLAW. Recently he demonstrated it at the AOSD 2002 Conference. He has a really neat approach to weaving aspects in .NET. Since .NET just-in-time compiles code, he was able to weave the aspect just prior to compilation of the target method.
|