Search code examples
c#odataasp.net-web-api2

webApi2 Odata v3 and V4 side by side


How can I have odata v3 and v4 api working side by side out on the same project ?

Can the same controller be returning data in both formats ? Do I need to have 2 copies of the same controller - one per Odata version ?

I know this should be possible cause the official WEBAPI page says it's been designed for.

"ASP.NET Web API supports both v3 and v4 of the protocol. You can even have a v4 endpoint that runs side-by-side with a v3 endpoint." - quote from www.asp.net

Question is - how do I do that ? Any tutorials ?


Solution

  • Here is a sample for side by side: https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/OData/v4/ODataSxSSample/, FYI. This sample has 2 copies of the same controller.