Aspect Oriented Programming for Silverlight
AOP or Aspect Oriented Programming allows developers to “weave” code fragments through their object and methods without explicitly placing the code in the class’s source. This additional code, often referred to as “advice”, is often stored in configuration files but other options exist. Probably the most widely AOP system is AspectJ, an extension for Java.
AOP has been controversial over the years. While many people swear by it for mundane tasks like security and logging, others balk at injecting code that cannot be easily viewed in the source. But even if you don’t like it, sooner or later chances are you are going to happen across code that uses it.
For .NET developers current using AOP or interested in trying it out, one option is PostSharp. PostSharp uses post-processing to add advice to classes. This involves modifying the compiled EXE or DLL to inject the necessary code fragments. For PostSharp, advice is usually indicated by Attributes.
Recently it has been announced that PostSharp 1.5 supports Silverlight 2. This CTP release also includes support for .NET Compact Framework and Novell’s Mono. Chris Koenig shows some examples of PostSharp.
Juergen Hoeller Jul 22, 2014