问题描述
我正在尝试找到一个相当成熟/稳定且免费提供(最好是开源)的库,用于在 .NET 中执行 AOP.我一直在四处寻找,找到了下面的产品;然而,他们中的大多数人似乎已经死了:
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 — 这是通常推荐的 AOP 解决方案.NET,但它是一种商业产品,因此有一些使用限制.(不过,它似乎可以免费用于个人或开源项目.)
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 — 不仅仅是关于 AOP,所以它是如果只想做 AOP,可能太强大了.(?)
Spring.NET — not exclusively about AOP, so it's probably too powerful if one only wants to do AOP. (?)
策略注入应用程序块 — 来自 Microsoft,我会希望至少能保持这一点.
Policy Injection Application Block — being from Microsoft, I would expect this to be at least maintained.
温莎城堡和DynamicProxy — 主要不是 AOP 库,但显然它可以用于那个目的.
Castle Windsor together with DynamicProxy — not primarily an AOP library, but apparently it can be used for that purpose.
Aspect# — 这对我来说似乎已经死了.
Aspect# — this seems quite dead to me.
Aspect.NET——这对我来说似乎也很死.
Aspect.NET — this also seems quite dead to me.
NAop — 显然不再受支持.
NAop — apparently no longer supported.
AOP.NET — 这应该是NAop的继任者,而且看起来也已经死了一段时间了.
AOP.NET — this was supposed to be the successor to NAop, and also looks like it died a while ago.
可能还有更多.从上面的列表中,我认为在 .NET 上执行 AOP 的唯一真正选择是 PostSharp(即使它是一个商业产品)、Spring.NET、Microsoft 的 Policy Injection Application Block 或 Windsor.
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?
另见问题对开源的建议StackOverflow 上的面向方面的 C# 库.我发布了一个新问题,因为我对 .NET 的各种 AOP 解决方案的开发/维护状态特别感兴趣.
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.
推荐答案
您不需要 Windsor 即可使用 DynamicProxy.Windsor 将 DynamicProxy 用于其自身目的,就像 NHibernate、RhinoMocks、Moq 或其他库/应用程序/框架一样.如果您只需要运行时 AOP,没有 IoC 容器,请单独使用 Caste DynamicProxy.
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.
它正在积极开发中,最后一个预发布版本是在 2 周前发布的,预计本月发布最终版本 (v2.5).
It is actively developed, last pre-release was released 2 weeks ago, final release (v2.5) is expected this month.
注意:在以前的版本(直到 v2.2)中,DynamicProxy 曾经存在于它自己的程序集 Castle.DynamicProxy.dll 中.它后来被转移到 Castle.Core.dll 并且现在不需要其他程序集来使用它.来源
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
这篇关于.NET 的哪些面向方面编程 (AOP) 库仍在积极开发中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!