Chapter 4. Before and after: boundary aspects

This chapter covers

  • What boundaries mean
  • Using PostSharp to bound methods
  • Writing an ASP.NET HttpModule to help detect mobile users
  • The differences (and similarities) of method interception and method bounding
  • Writing a caching aspect with PostSharp

In chapter 3, I covered one of the most common types of method aspects you can write: method interception. These aspects contain code that runs instead of the code that it intercepts.

Another type of aspect you might use is a boundary aspect, which contains code that runs around the code that it’s bounding. (Most commonly, these aspects are methods, but other types of boundaries exist, including page requests, ASP.NET MVC controller actions, ...

Get AOP in .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.