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.
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 ;)
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?
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
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
is working on a reply...