Udostępnij za pośrednictwem


DataServiceContext.BeginExecuteBatch Method

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

Asynchronously submits a group of queries as a batch to the data service.

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

Syntax

'Declaration
Public Function BeginExecuteBatch ( _
    callback As AsyncCallback, _
    state As Object, _
    ParamArray queries As DataServiceRequest() _
) As IAsyncResult
public IAsyncResult BeginExecuteBatch(
    AsyncCallback callback,
    Object state,
    params DataServiceRequest[] queries
)

Parameters

  • callback
    Type: System.AsyncCallback
    The delegate that is called when a response to the batch request is received.
  • state
    Type: System.Object
    User-defined state object that is used to pass context data to the callback method.

Return Value

Type: System.IAsyncResult
The query result.

Remarks

The queries are specified as DataServiceRequest<TElement> instances. Returns a DataServiceResponse that represents the response of the whole batch request. Individual query responses are represented as DataServiceResponse objects that can be accessed by enumerating the DataServiceResponse instance.

When this method returns, the HTTP response for the batch request has been read from the network stream but the responses have not been processed. No identity resolution or object materialization occurs for a specified entity in the response until it is enumerated.

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.