tags:

views:

246

answers:

2

How do I modify the description of each item in the help page when using the rest collection template?

+1  A: 

When you use the template it gives you access to the file Service.svc.cs right inside your project, and you'll see the class inside that file inherits from CollectionServiceBase<TItem>. You need to modify that class in order to change the descriptions in the help page. Unfortunately CollectionServiceBase<TItem> is already pre-built for you and it's part of the binary Microsoft.ServiceModel.Web.dll, so you can't edit it from VS.

The way to work around this is to crack open the source code of the starter kit (zipped up at %ProgramFiles%\Microsoft WCF REST\WCF REST Starter Kit Preview 2) and hunt for the file CollectionServiceBase.cs, where the type CollectionServiceBase<TItem> is defined. You then need to copy that file to your solution (so you can modify it) and make sure it is referenced from Service.svc.cs.

In CollectionServiceBase<TItem> itself, look for the [WebHelp] attruibute and you'll be able to edit the descriptions on that attribute.

Yavor Georgiev - MSFT
A: 

Excellent answer - thanks, Yavor.

That also answers the question I have been struggling with - how to add methods to a web service based on a Starter Kit template. We simply have to edit our copy of the CollectionServiceBase.cs file.

Note: On adding the CollectionServiceBase.cs copy to my solution, I received warnings about potential conflict vs the originally imported version. I resolved this by renaming my version (and the links to it).

Dave-Ashby