Chapter 3. Call this instead: intercepting methods

This chapter covers

  • What method interception means
  • Using Castle DynamicProxy to intercept methods
  • Writing a data transaction aspect
  • Using PostSharp to intercept methods
  • Writing a threading aspect

In chapter one, I talked about join points and pointcuts. I left the definition of these terms fairly broad, defining a join point as any point in between your code and describing a pointcut as a collection of join points. I kept these definitions loose because aspects can theoretically be applied to any location in your code that you can describe. You could put an aspect inside of an if statement or use it to modify a for loop. But you don’t need to do that 99% of the time in practical application. ...

Get AOP in .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.