Getting started with ASP.NET OData WebApi
Some notes just for future reference.
There are two packages for implementing OData services in ASP.NET:
- Microsoft.AspNet.WebApi.OData for OData v3, and depends on:
- Microsoft.Data.OData
- Microsoft.AspNet.OData for OData v4, and depends on:
- Microsoft.OData.Core
- Microsoft.OData.Edm
- Microsoft.Spatial
To implement an OData v4 service (a server), follow the steps at:
http://odata.github.io/WebApi/
To implement a C# client:
- Create a new C# project, e.g., a C# console application.
- In Visual Studio, go to Extensions and Updates, then select Online, search and install OData v4 Client Code Generator.
- Add a new item of type OData Client file and set
MetadataDocumentUri
with your service $metadata URI, e.g.,http://localhost:17666/$metadata
- Save and when the Security Warning dialogue pops up, click OK.
- Then, copy and paste the sample from http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-client-app