Aspect Framework

Add custom design patterns to your .NET apps automatically.

PostSharp Aspect Framework

Objective

Automation of custom design patterns.

Platforms

.NET Framework 2.0, 3.5, 4.0, 4.5

Silverlight 4, 5

Windows Phone 7, 8

Windows Store 8, 8.1

Available with

PostSharp Express (limited)

PostSharp Pro

PostSharp Ultimate

See Also

Automation of standard design patterns

Control of hand-written design patterns

Nearly 20 years after the Gang of Four theorized design patterns, mainstream languages such as C# still force developers to write code at an irrelevant level of abstraction.

In what may be the largest use of copy-paste inheritance in the industry, manual implementation of design patterns results in the mass production of boilerplate code, adding to the cost of developing and maintaining applications.

Many are unaware that an advanced compiler technology exists that enables engineers and architects to automate the implementation of design patterns by encapsulating them into reusable components.

The technology is called Aspect-Oriented Programming (AOP) and it's backed by more than 20 years of research and industry practice.

PostSharp has provided the best of AOP to Microsoft .NET developers since 2004.

Learn more about Design Pattern Automation
Learn more about Aspect-Oriented Programming




Examples

How does it work?

It's not magic: first get things clear in your head, then translate your ideas into code.

  1. Think about how you would explain the pattern to your colleague.
  2. Grab a pencil and, in plain English, write what needs to be transformed (e.g., all public methods) and how (e.g., add a try/catch block and call the exception handling service).
  3. Translate your ideas into code: create an aspect class and add building blocks for each code transformation.
  4. Apply the aspect to your business code.
  5. Build your project.

Think of PostSharp as a compiler extension. It applies the transformations exactly as you ordered and under the hood, PostSharp integrates with MSBuild and post-processes the compiler output.




Building blocks

Apply aspects to code

Download PostSharp

Install PostSharp from Visual Studio Gallery. A single download includes all features of all editions.
After the 45-day trial, you can choose to buy the product or to stay with the free PostSharp Express.