Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which WebApi OData namespace

Which namespace should I be using for the latest Microsoft Web API OData:

System.Web.Http.Odata or System.Web.Odata?

The same classes appear in both namespaces, but I have not found anything directly stating which one to use.

I did find this article where the code examples are using System.Web.OData: http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint

I just want to be sure.

like image 884
Chris Avatar asked Dec 15 '22 15:12

Chris


1 Answers

There exist two namespaces and assemblies because the two versions of OData are incompatible, though they can be used side-by-side.

Use System.Web.Http.OData for OData v3 and use System.Web.OData for OData v4.

You can read more about this on this blog post: http://blogs.msdn.com/b/webdev/archive/2014/03/13/getting-started-with-asp-net-web-api-2-2-for-odata-v4-0.aspx

You can find samples for Web API OData v3 and OData v4 here: https://github.com/OData/ODataSamples/tree/master/WebApi

like image 63
Eilon Avatar answered Jan 09 '23 14:01

Eilon