views:

251

answers:

2

Hi,

In various projects I worked with, we had to use some AOP or dependency injection framework.

We used Enterprise LIbrary, Unity and PostSharp.

For now, Postsharp is my best choice when it comes to the flexibiity I get over how I generate my aspects.

The only problem is the build time required once PostSharp is installed. My developpers don't like to pay the time tax even in regard of all the godness comming from PostSharp.

So my question is : What AOP framework would you recommand for fast build time AND great fonctionnality ?

Thanks, your answers are greatly appreciated,

Patrick

A: 

Spring.NET doesn't use weaving and it is based on a very stable Java aop framework. Here's the project address.

Otávio Décio
+5  A: 

PostSharp is a basically a full featured static weaver. That means the weaving takes place during the build process, in a post-compilation step. And for sure, it can takes some time. (Be sure to read Gael announcement about runtime performance improvements and build time performance improvements that will come with the version 2.0)

If you don't want any build time overhead, there is only one solution : use dynamic weavers. In .NET, there are several interception frameworks, like Castle.DynamicProxy, or Linfu.DynamicProxy. They generate proxies at runtime. Be aware that theses frameworks can't do as much as a static AOP framework like PostSharp can, and may also perform less efficiently at runtime. Very often, IoC frameworks offer dynamic interception capabilities (Spring.NET, Unity, Windsor, etc.)

One other solution is to look at hybrid weavers, which only weaves join points during the build process, in a static manner, and then allow you to apply aspect dynamically at runtime. Linfu.AOP, which uses Mono.Cecil as a backend, works like that.

Romain Verdier