In this chapter we will cover:
Building an OData service via WCF Data Service and ADO.NET Entity Framework
Building an OData service with WCF Data Service and LINQ to SQL
Exposing OData endpoints from WCF RIA Service
Adding custom operations on OData service
Exposing database stored procedures in WCF Data Service
Using custom data objects as the data source of WCF Data Service
Using Interceptors to customize a WCF Data Service
Accessing ASP.NET context data in WCF Data Service
Creating a custom WCF Data Service provider
Open Data Protocol (OData) is a web protocol for querying and updating data, which can be freely incorporated in various kinds of data access applications. OData makes itself quite simple and flexible to use by applying and building upon existing well-defined technologies, such as HTTP, XML, AtomPub, and JSON.
WCF Data Service is the main component for building OData service on .NET Framework platform. WCF Data Service supports exposing various data source models such as ADO.NET Entity Framework, LINQ to SQL, and CLR Objects through OData service endpoints. Also, we're not limited to these existing data models, we can build our own custom Data Service Provider or convert other services (such as WCF RIA service) to OData service. In this chapter, we will demonstrate several cases of using WCF Data Service to build OData services that can deal with different kinds of data source models.