Generating the Data Service Client Library (WCF Data Services)
A data service that implements the Open Data Protocol (OData) can return a service metadata document that describes the data model exposed by the OData feed. For more information, see OData: Service Metadata Document. You can use the Add Service Reference dialog in Visual Studio to add a reference to an OData-based service. When you use this tool to add a reference to the metadata returned by an OData feed in a client project, it performs the following actions:
Requests the service metadata document from the data service and interprets the returned metadata.
The returned metadata is stored in the client project as an .edmx file. This .edmx file cannot be opened by using the Entity Data Model designer because it does not have the same format an .edmx file used by the Entity Framework. You can view this metadata file by using the XML editor or any text editor. For more information, see the [MC-EDMX]: Entity Data Model for Data Services Packaging Format specification
Generates a representation of the service as an entity container class that inherits from DataServiceContext. This generated entity container class resembles the entity container that the Entity Data Model tools generate. For more information, see Object Services Overview (Entity Framework).
Generates data classes for the data model types that it discovers in the service metadata.
Adds a reference to the
System.Data.Services.Clientassembly to the project.
For more information, see How to: Add a Data Service Reference.
The client data service classes can also be generated by using the DataSvcUtil.exe tool at the command prompt. For more information, see How to: Manually Generate Client Data Service Classes.
Client Data Type Mapping
When you use the Add Service Reference dialog in Visual Studio or the
DataSvcUtil.exe tool to generate client data classes that are based on an OData feed, the .NET Framework data types are mapped to the primitive types from the data model as follows:
|Data model type||.NET Framework data type|
For more information, see OData: Primitive Data Types.