.Net 中 AOP 的最佳实现是什么? [英] What is the best implementation for AOP in .Net?
问题描述
在 C#、VB.net 中有很多 AOP 实现.这是一些 AOP 实现:
There is a lot of AOP implementation in C#, VB.net. this is some of AOP Implementations:
- PostSharp
- 城堡动态代理
- LinFu
- LOOM.NET
- Aspect.NET
- 企业库 3.0 政策注入应用块
- AspectDNG
- DotSpect (.SPECT)
- Spring.NET 框架作为其功能的一部分
- Wicca 和 Phx.Morph
- 对 AOSD 的详尽分析.NET 解决方案可从特温特大学获得
- Seasar.NET
- 方面#
- Puzzle.NAspect
- 撰写*
- 设定点
- NConcern .NET AOP 框架
- ...
- PostSharp
- Castle DynamicProxy
- LinFu
- LOOM.NET
- Aspect.NET
- Enterprise Library 3.0 Policy Injection Application Block
- AspectDNG
- DotSpect (.SPECT)
- The Spring.NET Framework as part of its functionality
- Wicca and Phx.Morph
- An exhaustive analysis on AOSD solutions for .NET is available from Twente University
- Seasar.NET
- Aspect#
- Puzzle.NAspect
- Compose*
- SetPoint
- NConcern .NET AOP Framework
- ...
.Net 中 AOP 的最佳实现是什么?我应该使用什么?
What is the best implementation for AOP in .Net? What I should use?
推荐答案
I think that Castle Dynamic Proxy is the solution of choice if dynamic interception can handle your needs. This framework is used internally by a lot of other frameworks that want to offer AOP capabilities. Typically, most of existing IoC containers now provide some dynamic interception mechanisms (Spring.NET, Castle Windsor, StructureMap, etc.) If you already work with an IoC container, maybe it could be easier to look at what it proposes.
如果动态拦截不能满足你的需求(编织密封类,拦截非虚调用等),那你当然想要静态编织.PostSharp 是该域中的引用.
If dynamic interception can't address your needs (weaving sealed class, intercepting non-virtual call, etc.), then you certainly want static weaving. PostSharp is the reference in this domain.
请注意,它还存在 Linfu,可用于利用两种 AOP 方式.
Note that it also exists Linfu, that can be used to leverage both AOP fashions.
这篇关于.Net 中 AOP 的最佳实现是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!