DataServiceContext.BeginExecute<'TElement> Method (Uri, AsyncCallback, Object)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Asynchronously sends the request so that this call does not block processing while waiting for the results from the service.

Namespace:   System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

member BeginExecute<'TElement> : 
        requestUri:Uri *
        callback:AsyncCallback *
        state:Object -> IAsyncResult

Parameters

requestUri
Type: System.Uri

The URI to which the query request will be sent. The URI may be any valid data service URI; it can contain $ query parameters.

callback
Type: System.AsyncCallback

Delegate to invoke when results are available for client consumption.

state
Type: System.Object

User-defined state object passed to the callback.

Return Value

Type: System.IAsyncResult

An object that is used to track the status of the asynchronous operation.

Type Parameters

TElement

The type returned by the query.

The returned IAsyncResult object is used to determine when the asynchronous operation has completed. For more information, see Asynchronous Operations (WCF Data Services).

The method BeginExecute<'TElement> uses the same semantics as Execute<'TElement>, however this method asynchronously sends the request so that this call does not block processing while waiting for the results from the service. According to the standard begin-end asynchronous pattern, the provided callback is invoked when query results are retrieved.

The following example shows how to execute an asynchronous query by calling the BeginExecute method to start the query. The inline delegate calls the EndExecute method to display the query results. This example uses the DataServiceContext generated by the Add Service Reference tool based on the Northwind data service, which is created when you complete the WCF Data Services .

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Silverlight
Available since 2.0
Return to top
Show: