开发者

Custom service contract attribute

开发者 https://www.devze.com 2023-04-09 01:23 出处:网络
I\'m looking to implement something similar to the way JSONP callbacks work with WCF in .NET 4. If you pass a callback parameter it wraps the response without callback needing to be in your method sig

I'm looking to implement something similar to the way JSONP callbacks work with WCF in .NET 4. If you pass a callback parameter it wraps the response without callback needing to be in your method signature. What I w开发者_开发问答ant to do is have an attribute that switches the response format if a parameter named format is passed. I want it to not require the format parameter in the method signature.

Anyone have a starting point suggestion, doubts of possibility, tips?


You'll need a couple of components to implement the response wrapping. JSONP support was added to WCF on .NET Framework 4.0, before that there was a sample which showed how it can be implemented, so you can look at that to see what you need to do. You can find the sample at http://msdn.microsoft.com/en-us/library/cc716898.aspx.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号