The WCF data services can be consumed through:
- Using an HttpWebRequest to invoke the service through the correspondent URL of the endpoint and process the OData feed that a data service returns; OR
- Creating a WCF client appication which includes the data service classes that are needed to access a data service from a .NET Framework client application
A WCF Data Service client is automatically created by the “DataSvcUtil.exe” utility that generates a class library used to interact directly with the service referenced.
The client library is defined on the System.Data.Services.Client namespace and includes two main classes:
- The DataServiceContext class whitch encapsulates operations that are supported against the specified data service. This class is used to maintain state on the client between interactions with the data service in order to support features such as entities update management.
- The DataServiceQuery<T> class represents a query against a specific entity set represented in the data model.
The generation tool will include a “.edmx” file (editable only through the XML editor) describing the data model of the service.
Alternativelly the spawned process can be manually and explicitly initiated at command-line by calling directly the ”DataSvcUtil.exe” utility:
datasvcutil /language:vb /out:ClientCode.vb /uri http://computerName/Training/Service1.svc