R – wcf rest starter kit 2

restwcf

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

Best Solution

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.