Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Drew 165 posts 339 karma points
    May 27, 2011 @ 12:59
    Drew
    0

    Stop Public Methods Being Picked Up As XSLTExtension?

    I've got a class decorated with the [XSLTExtension] attribute.

    All my public static methods are picked up and displayed as extensions in the CMS - great!

    But my class is a generic wrapper for another API, so some methods I have (which are public) accept "non umbraco friendly" values, like Enums.

    Unfortunately, unlike the [RestExtension] attribute, the [XsltExtension] attribute appears to only be allowable on classes and not individual methods.

    So is there a simple way I can block specific public methods from showing up as Xslt Extensions?

     

     

     

  • Richard Soeteman 3875 posts 12037 karma points MVP
    May 27, 2011 @ 15:46
    Richard Soeteman
    0

    Hi,

    I think the whole class is exposed as XSLTExtension. What I would do is create a seperate class that only contains the methods you want to use In the XsltExtension and pass the method call through to the class you are currently using. Then you only have the methods you want to expose in xslt in a single class.

    Cheers,

    Richard

     

  • Drew 165 posts 339 karma points
    May 27, 2011 @ 16:59
    Drew
    0

    This is what I've already done - create a wrapper which has the XsltExtension attribute declared on the class, but it does mean a little bit of code redundancy.

    Being able to decorate individual methods would be great - simply because if I end up building a fairly extensive library of API wrappers for C# consumers and want to expose them to Umbraco I've got to create a load of wrappers...

    ....or write my own custom attribute to handle it... now there's an idea ;)

     

    Cheers

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies