21
votes

I am trying to find a reasonably mature/stable and freely available (preferably open-source) library for doing AOP in .NET. I've been searching around a bit and found the products below; however, most of them seem dead:

  • PostSharp — this is the AOP solution usually recommended for .NET, however it's a commercial product and thus some use restrictions apply. (However, it seems to be sort-of freely available for personal or open-source projects.)

  • Spring.NET — not exclusively about AOP, so it's probably too powerful if one only wants to do AOP. (?)

  • Policy Injection Application Block — being from Microsoft, I would expect this to be at least maintained.

  • Castle Windsor together with DynamicProxy — not primarily an AOP library, but apparently it can be used for that purpose.

  • Aspect# — this seems quite dead to me.

  • Aspect.NET — this also seems quite dead to me.

  • NAop — apparently no longer supported.

  • AOP.NET — this was supposed to be the successor to NAop, and also looks like it died a while ago.

There's probably even more. From the above list I gather that the only real options for doing AOP on .NET is PostSharp (even though it's a commercial product), Spring.NET, Microsoft's Policy Injection Application Block, or perhaps Windsor.

Did I forget any major option?


See also the question Suggestions for open source aspect-oriented library for C# here on StackOverflow. I posted a new question because I'm specifically interested in the state of development/maintenance of various AOP solutions for .NET.

2
Good question, I'd love to know the latest and greatest on this most interesting topic, that I haven't had a chance to get into. But please, increase the font size of the footnote, even my monitor is squinting.Allon Guralnek
This stuff was developed a long time ago, .NET is almost 10 years old already. Avoid confusing dead with done or "no longer interesting" for FOSS. It isn't dead if somebody is still paying the hosting fees.Hans Passant
@Hans Passant: Sorry for being too lax with terminology, I can later edit my question if this seems important. But I would prefer that answers to my question focus on what is active / up-to-date / in widespread use / etc., not on what is dead / obsolete / no longer interesting / whatever.stakx - no longer contributing
Is Spring.NET still actively developed?EJoshuaS - Reinstate Monica
@EJoshuaS: Judging by the source code repository's activity, no. The last commit happened in 2016, and the few ones before that in 2015. That's just my impression though, perhaps best to ask the maintainers themselves.stakx - no longer contributing

2 Answers

6
votes

You don't need Windsor to use DynamicProxy. Windsor uses DynamicProxy for its own purposes, just like NHibernate, RhinoMocks, Moq or other libraries/applications/frameworks out there. If you need just runtime AOP, without IoC container, use Caste DynamicProxy alone.

It is actively developed, last pre-release was released 2 weeks ago, final release (v2.5) is expected this month.

Note: In previous versions (up to v2.2) DynamicProxy used to live in its own assembly Castle.DynamicProxy.dll. It was later moved to Castle.Core.dll and now no other assembly is required to use it. Source

1
votes

There was also Aurum (available at www.machinaaurum.com.br), which was built upon Unity. The source is available on Codeplex.