什么是AOP在.NET中最好的实现?最好的、AOP、NET

2023-09-02 10:21:33 作者:〆賤人╮

有很多的AOP实现在C#,VB.net。这是一些AOP实现的:

There is a lot of AOP implementation in C#, VB.net. this is some of AOP Implementations:

PostSharp LOOM.NET Aspect.NET 企业库3.0策略注入应用程序块 AspectDNG DotSpect (.SPECT) 的 Spring.NET 框架作为其功能的一部分 巫术并Phx.Morph 对.NET解决方案,成人Still病详尽的分析可从特温特大学 Seasar.NET 方面# Puzzle.NAspect 在撰写* 的SetPoint ... PostSharp 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 ...

什么是AOP在.NET中最好的实现?我应该使用什么?

What is the best implementation for AOP in .Net? What I should use?

推荐答案

我觉得城堡动态代理是选择的解决方案,如果动态拦截可以处理您的需求。该框架是由很多希望提供AOP功能等框架内部使用。通常情况下,大多数现有的IoC容器现在都提供一些动态的拦截机制(Spring.NET,温莎城堡,StructureMap等),如果您已经与IoC容器的工作,也许它可能是更容易地看看它提议。

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.

请注意,它也存在李林甫时,可以使用的同时利用AOP时装。

Note that it also exists Linfu, that can be used to leverage both AOP fashions.