共用方式為


Exposing Your Data as a Service (ADO.NET Data Services)

ADO.NET Data Services integrates with Visual Studio to enable you to more easily define services to expose your data. Creating a data involves the following basic steps:

  1. Select a host (optional). By default, when you create a data service in an ASP.NET application, the data services are hosted by ASP.NET. However, because the data service is not bound directly to a network socket, it does not directly accept HTTP requests. This means that you can select the process that hosts your data service, such as a Windows Communication Foundation (WCF) service. For more information, see Hosting the Data Service (ADO.NET Data Services).

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

  3. Definethe data model. ADO.NET 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 (ADO.NET Data Services).

    ADO.NET Data Services also supports data models that are based on common language runtime (CLR) objects that return an instance of the IQueryable 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 (ADO.NET Data Services).

    ADO.NET Data Services also 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 (ADO.NET Data Services).

  4. Configure the data service. By default, ADO.NET 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 ADO.NET Data Services, and to define other service-wide behaviors, such as batching behaviors or the maximum number of objects that can be inserted in a single request. For more information, see Configuring the Data Service (ADO.NET Data Services).

For an example of how to create a simple data service that is based on the Northwind sample database, see Quickstart (ADO.NET Data Services).

See Also

Other Resources

Getting Started with ADO.NET Data Services

ADO.NET Data Services Overview