PostSharp - OperationContract中的OnMethodBoundaryAspect

时间:2014-08-22 13:57:17

标签: wcf aop postsharp

我在OperationContract中使用PostSharp - OnMethodBoundaryAspect。虽然这方面似乎没有。我对postharp dll有必要的参考。下面的伪代码。

  • 方面

    [Serializable]
    [MulticastAttributeUsage(MulticastTargets.Method, Inheritance =  MulticastInheritance.Multicast)]
    public class LoggingAspect : OnMethodBoundaryAspect
    {
      //Implementation for entry and exit
    }
    
  • 用法

    [ServiceContract]
    public interface ITest
    {
     [OperationContract]
     [LoggingAspect(.....)]
      void Test();
    }
    

非常感谢任何帮助

1 个答案:

答案 0 :(得分:0)

我们需要做以下

  1. 通过NuGet在要编写自定义方面的项目上安装Postsharp。
  2. 这将确保目标存在于.csproj文件中,从而在编译期间启用注入。
  3. 在所有希望使用#1
  4. 中提到的方面的项目中,通过NuGet安装PostSharp

    感谢AlexD和Daniel Balas的投入

相关问题