tags:

views:

3228

answers:

4

In large apps I find myself really wishing I had built-in AOP facilities. As it stands in C# the best you can do is factories and RealProxys, PostSharp, ICorDebug, ICorProfiler or injection frameworks. There is no clean built-in way of doing AOP.

Is there any indication anywhere (blog post / internal discussion) that indicates that AOP is on the way?

+3  A: 

I haven't heard of a "clean built-in way of doing AOP". But as you stated, there are already plenty "clean ways of doing AOP", using mature and powerful frameworks like PostSharp or Castle DynamicProxy.

Using the BCL, one obvious way to do AOP, with pretty strong limitations thought, is to use transparent and real proxys, from .NET Remoting stack.

Another way is to rely on System.Reflection.Emit to dynamically generate proxies, like, hum, DynamicProxy from Castle.

Finally, there is also another official Microsoft flagged solution, that came with the Enterprise Library. I'm talking about the Policy Injection Application Block. Unity also offers some interception capabilities that leverage PIAB.

Romain Verdier
PostSharp went commercial which is not appropriate for that kind of library.
aloneguid
@aloneguid I'm pretty sure V1.5 remains free and still offers more capabilities than many others static weavers. Plus, why would you consider that some libraries can be commercial and some others can't?
Romain Verdier
+2  A: 

Romain's answer covers (almost :) perfectly the current solutions. As for the future support, Anders Hejlsberg has previously stated that they'were in wait & see mode about AOP.

We can only hope that with the managed rewrite of csc, and a «Compiler as a Service», one could plug into the compiler, and inject aspects there.

Jb Evain
Do you guys do native AOP in mono?
Sam Saffron
There's nothing special in Mono wrt AOP. We already have a managed compiler though, which is easily hackable, it would be a good starting point to have something which feels more integrated to the compiler.
Jb Evain
A: 

The May release of Delphi Prism has AOP support at the language level.

You can find out more about it here

http://prismwiki.codegear.com/en/Cirrus

There is also an open source library of aspects from this location

http://code.remobjects.com/p/prismaspects/

Mosh
A: 

Spring.NET provides AOP as well. It takes a lot of configuration but once it's set up it works well.

Matt