开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜