What Is PostSharp?

PostSharp is a Post-Compiler 

PostSharp is inserts itself in the build process and post-processes the compiled assembly. Since PostSharp works at MSIL level, it supports virtually all static languages targeting the .NET Framework.

PostSharp is an Aspect-Oriented Framework

PostSharp brings Aspect-Oriented Programming (AOP) to the Microsoft .NET Framework. Better: PostSharp makes AOP pragmatic and goes to the point.

Aspect-Oriented Programming takes note that traditional object-oriented programming don't offer any satisfying solution to a whole class of problems.

For instance, we cannot implement tracing, exception handling, thread synchronization or most of other technical requirements (aka non-functional requirements) without adding a lot of redundant code to every single method requiring these behaviors. And there can be hundreds.

PostSharp and AOP help in restoring the principle of separation of concerns by offering a way to better encapsulate technical requirements into aspects:

  1. Technical requirements are encapsulated as aspects, which are plain C#/VB classes.
  2. Aspects are applied to business objects without invading the source code of business methods.
  3. At build time, aspects are injected into business methods.

PostSharp is Extensible

From the first line of code, PostSharp has been designed as an extensible platform for post-processing of .NET assemblies. All analysis and transformations are encapsulated into tasks, which are packaged into plug-ins and loaded in the platform. This platform is named PostSharp Core, while we group under the term PostSharp all the members of this product family.

Most of people use existing plug-ins, like PostSharp Laos. They do not need any extensive knowledge of PostSharp Core and MSIL. If you have more specific requirements, or if you are an Independent Software Vendor producing development tools, you may want to develop your own plug-ins, or even to integrate the platform into your existing tools.

PostSharp Architecture


Comments are closed