Sdílet prostřednictvím


How to: Add a data service reference (WCF Data Services)

Important

WCF Data Services has been deprecated and will no longer be available for download from the Microsoft Download Center. WCF Data Services supported earlier versions of the Microsoft OData (V1-V3) protocol only and has not been under active development. OData V1-V3 has been superseded by OData V4, which is an industry standard published by OASIS and ratified by ISO. OData V4 is supported through the OData V4 compliant core libraries available at Microsoft.OData.Core. Support documentation is available at OData.Net, and the OData V4 service libraries are available at Microsoft.AspNetCore.OData.

RESTier is the successor to WCF Data Services. RESTier helps you bootstrap a standardized, queryable, HTTP-based REST interface in minutes. Like WCF Data Services before it, Restier provides simple and straightforward ways to shape queries and intercept submissions before and after they hit the database. And like Web API + OData, you still have the flexibility to add your own custom queries and actions with techniques you're already familiar with.

You can use the Add Service Reference dialog in Visual Studio to add a reference to WCF Data Services. This enables you to more easily access a data service in a client application that you develop in Visual Studio. When you complete this procedure, data classes are generated based on metadata that is obtained from the data service. For more information, see Generating the Data Service Client Library.

Add a data service reference

  1. (Optional) If the data service is not part of the solution and is not already running, start the data service and note the URI of the data service.

  2. In Visual Studio, in Solution Explorer, right-click the client project and then select Add > Service Reference.

  3. If the data service is part of the current solution, click Discover.

    -or-

    In the Address text box, type the base URL of the data service, such as http://localhost:1234/Northwind.svc, and then click Go.

  4. Select OK.

    A new code file that contains the data classes that can access and interact with data service resources is added to the project.

See also