WCF currently does not allow having a single operation definition and switch the content type for the response according to some runtime setting (Which could be the Accept or Content-Type request header for instance).
It would be great to have an attribute with the syntax below to specify which content type should be used.
[WebGet(UriTemplate = CollectionServiceBase<TItem>.ItemsUriTemplate)]
[DynamicContentType(Direction=DynamicDirection.Both, Resolution=DynamicResolution.UriTemplate, UriTemplateVariable="content")]
Where Direction and Resolution could support some of these values,
public enum Direction
public enum Resolution
I created a post "http://weblogs.asp.net/cibrax/archive/2008/12/05/dynamic-content-type-a-nice-to-have-feature-for-the-rest-starter-kit.aspx
to describe more the solution.