PostSharp集会上我没有源 [英] PostSharp on assemblies I don't have source for

查看:184
本文介绍了PostSharp集会上我没有源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在他们的网站上的例子中,PostSharp具有拦截在主系统组件的调用的演示。我已经尝试了几次设置和复制表示,集会拦截来电我没有源代码,但没有成功。



我的方法是简单地将汇编级属性定位,我想乐器命名空间和方法。这从来没有为我工作。



是这样的:



[汇编:跟踪(MyCategory,AttributeTargetTypes =My.BusinessLayer。*)]



我在这里丢失的东西吗?我不能做一个组装我的仪器仪表方面的运行时间注射,如果我没有做源拉到呢?我想我可以做注射运行...



感谢。


解决方案
<

  [汇编:跟踪(MyCategory,
AttributeTargetAssemblies p>您可以通过指定跟踪的其他组件的方法=XYZ,
AttributeTargetTypes =My.BusinessLayer。*)]

不过中,外部组件将不会被修改!只有从当前项目外部组件可被修改来电。



这是目前不容易修改组件你没有来源。这是可能的,但被认为是一种先进的方案,并要求定制编码。


In the examples on their website, PostSharp has a demo of intercepting calls in main system assemblies. I have tried a few times to setup and replicate said intercept calls on assemblies I don't have the source code for with no success.

My approach was to simply place the assembly level attribute targeting the namespace and method I wanted to instrument. This has never worked for me.

something like:

[assembly: Trace("MyCategory", AttributeTargetTypes = "My.BusinessLayer.*")]

Am I missing something here? Can I not do a runtime injection of my instrumentation aspect on a assembly if I don't have the source pulled in for it? I thought I could do runtime injections...

Thanks.

解决方案

You can trace methods of other assemblies by specifying:

[assembly: Trace("MyCategory",
                 AttributeTargetAssemblies="xyz",
                 AttributeTargetTypes = "My.BusinessLayer.*")]

However, the external assembly will not be modified! Only calls from the current project to the external assembly can be modified.

It is currently not easy to modify assemblies you don't have the source of. This is possible, but is considered an advanced scenario and requires custom coding.

这篇关于PostSharp集会上我没有源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆