PostSharp 访问原始属性标记字符串参数
我有一个实现 OnMethodBoundaryAspect 的 POstSHArp 属性。标记如下:
[ExceptionLogging("RepositoryLayer")]
我想要在方面的实现中执行的操作是访问通过上面的属性标记传递的字符串。这个想法是,基于这个值,我可以(以非常基本的方式)看到在架构中调用方面的位置,在本例中是在存储库层中。
如何通过方面实现来访问该值?我在 EVentArgs 或其他任何地方都找不到它。
非常感谢
布莱恩
I have a POstSHarp attribute implementing OnMethodBoundaryAspect. The mark up is as follows:
[ExceptionLogging("RepositoryLayer")]
What I want to do within the implementation of the aspect is access the string that was passed with the attribute markup above. The idea is that based on this value I can see (in a very rudimnentary manner) where the aspect is being called in the architecture, in this case in the Repository Layer.
How do I get access to this value with the aspect implementation? I cannot find it anywhere in the EVentArgs or anywhere else.
Many thanks
Brian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
构造函数应该将字符串存储在切面类的实例字段中;然后您可以从 OnException 方法访问实例字段。
The constructor should store the string in an instance field of the aspect class; then you can access the instance field from the OnException method.