Поделиться через


DataServiceContext.EndExecute<TElement> Method

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

Called to complete the BeginExecute.

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

Syntax

'Declaration
Public Function EndExecute(Of TElement) ( _
    asyncResult As IAsyncResult _
) As IEnumerable(Of TElement)
public IEnumerable<TElement> EndExecute<TElement>(
    IAsyncResult asyncResult
)

Type Parameters

  • TElement
    The type returned by the query.

Parameters

Return Value

Type: System.Collections.Generic.IEnumerable<TElement>
The response to the query operation.

Exceptions

Exception Condition
ArgumentNullException

When asyncResult is nulla null reference (Nothing in Visual Basic).

ArgumentException

When asyncResult did not originate from this instance or EndExecute<TElement> was previously called.

InvalidOperationException

When an error occurs in the request or when materializing the results of a query into objects.

Remarks

According to the standard begin-end asynchronous pattern, the provided callback is invoked when query results are retrieved.

When the callback is invoked, all results have been read from the HTTP stream, but they have not been processed; no local user-facing objects have been materialized or modified and identity resolution has not occurred. When EndExecute<TElement> is invoked, a DataServiceResponse is created and returned but the results still have not been processed. Identity resolution, object materialization, and manipulation occur only when the user enumerates the results.

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.