Built-in AOP in C# - is it on the way?

前端 未结 4 728
鱼传尺愫
鱼传尺愫 2020-12-08 07:37

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, ICorProfi

4条回答
  •  不知归路
    2020-12-08 07:42

    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.

提交回复
热议问题