I’ve implemented a WCF OData Service in my project. Right now I need to my services return JsonResult for my clients. How can I implement Restful WCF OData Service? Or is there any alternative approach to return JsonResult in my services?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
OData Services natively support JSON. So if in the HTTP Request header you are specifying following header, you would always get JSON
If you can not control the this, then I suggest you to use $format filter.
For example See http://odata.netflix.com/v2/Catalog/Genres?$Format=json
JSONp and URL-controlled format support for ADO.NET Data Services download from MSDN http://code.msdn.microsoft.com/DataServicesJSONP and add the JSONPSupportBehavior decorator to your DataService class like below.
The other option could be to build ASP.NET Web API. Its an ideal platform for building RESTful applications on the .NET Framework.