PostSharp Aspect Framework

Aspect-Oriented Programming

Build automation for your own patterns to reduce development effort and improve architecture.

Have a custom pattern in your code? With PostSharp you can build automation for any pattern you need using the same tooling we use.

  • Amplify developer skills
  • Build custom patterns
  • Exceptional performance

When code no longer fits a single person's brain.

Teach the Compiler to Do More

Deliver more than guidelines – Patterns are usually described using implementation guidelines, and sometimes these guidelines are fully algorithmic with no decision left to the developer. That’s exactly what machines are good at, so why not offload that work to the compiler?

Achieve economies of scale – With PostSharp, you write an aspect once, saving time and reducing source code each and every time it is applied to your codebase.

Improve the Architecture

Encapsulate patterns – Objects are a great encapsulation tool but they struggle at addressing functionalities that repeat throughout the application. Aspects are the right way to encapsulate patterns that need to be applied over and over again.

Reduce complexity – Move complexity to aspects and write business logic at a higher level of abstraction.

Write cleaner code – Fewer lines of code means a smaller surface for defects to occur. Code that is easier to read and understand is easier to modify and produces fewer defects.

Multiply Knowledge

Encapsulate experience – Experienced developers will use their unique knowledge to build aspects that are specific to your codebase. Deployed to the rest of the team, these aspects will allow anyone to consistently add complex functionality with ease.

Apply easily – Once created aspects are very easy to apply and use. Developers who will only use the aspects don’t require additional PostSharp training.

Flexible by design

Method
Decorator
Method
Interceptor
Field/Property
Interceptor
Event
Interceptor
Method
Injector
Property
Injector
Event
Injector
Interface
Injector
Attribute
Injector
Resource
Injector
Aspect
Provider
Advice
Provider

Rich building blocks – Aspects are not limited to working only with methods. Perform actions against event registrations, properties and other constructs.

Expressive combinations – Assemble the building blocks at compile time using the full power of C# and reflection.

Non-invasive – Add functionality where you want in your codebase without having to change any code.

Solid foundation – Custom aspects are built using the same infrastructure and code that the PostSharp built-in patterns are.

Exceptional Performance

Compile time execution – Run aspect code during compilation and reduce the execution required at run-time.

No runtime reflection – Strong typing and compile time execution eliminate the need for you to write reflection code for run-time execution.

Key Facts

Supported Platforms

.NET Framework 3.5, 4.0, 4.5

Silverlight 5

Windows Phone 8, 8.1

Windows Store 8, 8.1

David Gressett

We consider the use of AOP and PostSharp a competitive advantage. We get tremendous benefits of each one of our concerns being very clean.

David Gressett, Chief Architect & Product Manager, FullArmor Corporation

PostSharp makes .NET languages stronger