Last post Feb 16, 2009 06:37 AM by LeeTheGreek
Feb 10, 2009 07:54 AM|LeeTheGreek|LINK
I have created a bunch of methods for my service, some will be available to the public, and others wont. If i then type "help", i get a list of all the methods, including all the methods i dont want the end user to see. Is there a way i can hide a method(s)
from being generated on the help page?
WCF REST Starter Kit
WCF REST CommunityFeedback
Feb 11, 2009 01:18 PM|randallt|LINK
There is no way to hide certain methods from the help page as it is currently. Although, since you have the source code with the REST starter kit, you could add the functionality to hide certain operations.
There are two places in the code you'll need to muck with:
(1) On the WebHelpAttribute class, add a public property called "Ignore" with a return value of bool.
(2) In the GetFeed() method of the HelpPageInvoker class there is a foreach loop for each operation in the contract description. Within the loop, simply add a conditional that checks if the WebHelpAttribute indicates if the operation should be ignored.
1 public Atom10FeedFormatter GetFeed()
3 List<SyndicationItem> items = new List();
4 foreach (OperationDescription od
6 WebHelpAttribute help = od.Behaviors.Find();
7 if (help !=
null && help.Ignore == false)
9 WebGetAttribute get = od.Behaviors.Find();
10 WebInvokeAttribute invoke = od.Behaviors.Find();
11 // Code continues on...
Now, in your service contract, to get the help page to ignore a certain operation just add [WebHelp(Ignore = true)] to the operation.
Feb 16, 2009 06:37 AM|LeeTheGreek|LINK
Thanks Randall, worked a treat! :)