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

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Public Function BeginExecute(Of TElement) ( _
    requestUri As Uri, _
    callback As AsyncCallback, _
    state As Object _
) As IAsyncResult
public IAsyncResult BeginExecute<TElement>(
    Uri requestUri,
    AsyncCallback callback,
    Object state
)

Type Parameters

  • TElement
    The type returned by the query.

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 that was passed to the callback.

Return Value

Type: System.IAsyncResult
The query result.

Remarks

The BeginExecute method 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.

You must use the BeginInvoke method of the Dispatcher class to correctly marshal the response operation back to the main application thread (the UI thread) of your Silverlight-based application. For more information, see Synchronizing Data for Multithreading.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.