views:

376

answers:

1

In order to get a WCF service working with JQuery I have added a WebInvoke attribute on the operation contract to control the JSON serialisation as follows:

[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]

Is there a way to control this serialisation via the service bindings in the config instead as it limits this service from providing different serialisations to different endpoints.

+1  A: 

Not as far as I know. Of course, you could argue that the [WebInvoke] is part of the calling convention, and thus part of the service-contract. As such, with a different serialization it is a different service contract, and should be represented by a different interface.

You could use a single class to implement 2 similar contracts (especially if you use implicit implementation - just add an extra interface to the : IFoo, IBar etc, and it should pick up the matching names automatically.

Marc Gravell