Working with OData Services using WCF and ASP.NET MVC Framework
In this section, we will discuss how we can create an OData Service and consume it from an ASP.NET MVC application. To get started using OData in .NET applications, you need to first create a WCF Data Service. You can create and use an Entity Data Model using the ADO.NET Entity Framework template in Visual Studio.
Here are the steps to create an OData Service:
Create an Entity Data Model or a source of data using LINQ to SQL. You can also use a custom data model, but it should implement the
IUpdateable
andIQueryable
interfaces.Expose the data model as a WCF Data Service.
Host the WCF Data Service.
Consume the WCF Data Service in a client application.
To create a WCF Data Service, click on Project | Add New Item and then select WCF Data Service from the list of the templates displayed. Note that you will need to add these references to your project:
System
System.Core
System.ServiceModel
System.ServiceModel.Web
System.Data.Services...