Roy Osherove has just published his interception framework. These posts always catch my interest because I know that there is no perfect solution for this in .NET, you either need to live in a COM+ container and use Clemens' code, or alternatively rely on real proxies (requires MBRs) or context attributes (requires CBOs).

Roy is using CBOs in this approach which means that ultimately the system is constrained. Personally I think the jury is still out on AOP, a lot of very smart people have gone into it declaring it as the saviour of maintainability of code and come back out espousing the virtues of a more explicit programming style.

One thing is for sure though, the students in my class this week will get a chance to play with all of them!

My hair brained scheme is to use CAS attributes (note: not seriously suggesting you do this), but its really a hack and has severe performance implications. The benefit would be is that you don't need a specific base class.

Acryonym Watch:

  • MBR - Marshal By Reference
  • CBO - Context Bound Object
  • AOP - Aspect Orientated Programming
  • CAS - Code Access Security
  • YAA - Yet Another Acronym