PostSharp - Attach to WebMethod-attribute methods only
Using PostSharp, is it possible to only "attach" to methods having the WebMethod-attribute?
Ex:
[Trace][WebService]
public partial class Service : System.Web.Services.WebService
{
// Caught by PS(WebMethod-attribute)
[WebMethod]
public void MyMethod()
{
return;
}
// Not caught by PS
public void MySecondMethod()
{
return;
}
}
Have Goog开发者_如何学编程led and searched like a maniac through the PS-community. But havent found what I'm looking for yet. Any comments in the right direction are useful.
Thanks!
There's no real support for that; instead you should use a CompoundAspect (that you would use at assembly or class level) and you may test for the present of the WebMethod custom attribute from the CompoundAspect.ProvideAspects method.
精彩评论