Data Access has been discontinued. Please refer to this page for more information.

How to: Consume Service Operations

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

The Open Data Protocol (OData) defines service operations for a data service. WCF Data Services enables you to define such operations as methods on the data service. Like other data service resources, these service operations are addressed by using URIs. There are three methods of the DataServiceContext class that can be used in order to consume service operations:

  • CreateQuery - creates a data service query.
  • Execute - queries a data service by URI.
  • BeginExecute - does the same as Execute but asynchronously.

The following code demonstrates how to use the BeginExecute method:

private EntitiesModel dataManager = new EntitiesModel(
   new Uri( "EntitiesModelService.svc/", UriKind.Relative ) );
   new Uri( string.Format( "{0}LoadCarsByMake?make='{1}'", dataManager.BaseUri, "BMW" ), 
        UriKind.RelativeOrAbsolute ),
   null );
private void OnQueryCompleted( IAsyncResult result )
   IEnumerable<Car> cars = dataManager.EndExecute<Car>( result );
Private dataManager As New EntitiesModel(New Uri("EntitiesModelService.svc/", UriKind.Relative))
dataManager.BeginExecute(Of Car)(
    New Uri(String.Format("{0}LoadCarsByMake?make='{1}'", dataManager.BaseUri, "BMW"), 
    AddressOf Me.OnQueryCompleted, Nothing)
Private Sub OnQueryCompleted(ByVal result As IAsyncResult)
 Dim cars As IEnumerable(Of Car) = dataManager.EndExecute(Of Car)(result)
End Sub