Expose Your Data as a Service (WCF Data Services)

WCF Data Services integrates with Visual Studio to enable you to more easily define services to expose your data as Open Data Protocol (OData) feeds. Creating a data service that exposes an OData feed involves the following basic steps:

  1. Define the data model. WCF Data Services natively supports data models that are based on the ADO.NET Entity Framework. For more information, see How to: Create a Data Service Using an ADO.NET Entity Framework Data Source.

    WCF Data Services also supports data models that are based on common language runtime (CLR) objects that return an instance of the IQueryable<T> interface. This enables you to deploy data services that are based on lists, arrays, and collections in the .NET Framework. To enable create, update, and delete operations over these data structures, you must also implement the IUpdatable interface. For more information, see How to: Create a Data Service Using the Reflection Provider.

    For more advanced scenarios, WCF Data Services includes a set of providers that enable you to define a data model based on late-bound data types. For more information, see Custom Data Service Providers.

  2. Create the data service. The most basic data service exposes a class that inherits from the DataService<T> class, with a type T that is the namespace-qualified name of the entity container. For more information, see Defining WCF Data Services.

  3. Configure the data service. By default, WCF Data Services disables access to resources that are exposed by an entity container. The DataServiceConfiguration interface enables you to configure access to resources and service operations, specify the supported version of OData, and to define other service-wide behaviors, such as batching behaviors or the maximum number of entities that can be returned in a single response. For more information, see Configuring the Data Service.

For an example of how to create a simple data service that is based on the Northwind sample database, see Quickstart.

See also