DataServiceContext::EndExecute<TElement> Method (IAsyncResult^)

 
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.

Called to complete the BeginExecute<TElement>.

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

public:
generic<typename TElement>
IEnumerable<TElement>^ EndExecute(
	IAsyncResult^ asyncResult
)

Parameters

asyncResult
Type: System::IAsyncResult^

IAsyncResult object.

Return Value

Type: System.Collections.Generic::IEnumerable<TElement>^

The results returned by the query operation.

Type Parameters

TElement

The type returned by the query.

Exception Condition
ArgumentNullException

When asyncResult is null.

ArgumentException

When asyncResult did not originate from this DataServiceContext instance.

-or-

When the EndExecute<TElement> method was previously called.

InvalidOperationException

When an error is raised either during execution of the request or when it converts the contents of the response message into objects.

InvalidOperationException

When an error is raised either during execution of the request or when it converts the contents of the response message into objects.

According to the standard begin-end asynchronous pattern, the provided callback is invoked when query results are retrieved. For more information, see Asynchronous Operations (WCF Data Services).

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.

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: