OData is consistent with the way the web works - it makes a deep commitment to URIs for resource identification and commits to an HTTP-based, uniform interface for interacting with those resources (just like the web). This commitment to core web principles allows OData to enable a new level of data integration and interoperability across a broad range of clients, servers, services, and tools. more
In this article I am using the same application as in the http://www.c-sharpcorner.com/UploadFile/amit12345/mvc-4-web-api-net-4-5/ article.
Let's see how OData is working on Web API.
Now here is our URL http://localhost:40683/api/customer. It's a MVC 4 Web API application. You can download it from the above specified article. You need to change only one thing in the CustomerController class. In the sample Get method the return type is IEnumerable<CustomerModel> so you have to change it to use IQueryable<CustomerModel>.
See the following code.
public IQueryable<CustomerModel> Get()
{
IQueryable<CustomerModel> list = null;
list = (from c in context.Customers
select new CustomerModel { Id = c.Id, Name = c.Name, Salary = (long)c.Salary }).AsQueryable<CustomerModel>();
return list;
}
You can see in the following image that there is data being shown for a Customer in the form of a list; now we fire a query on the list.
Let's see what the OData Uri Conventions are.
There is much more about OData; you can find more in http://www.odata.org/documentation/uri-conventions#ExpandSystemQueryOption.
Happy Coding.