This topic has not yet been rated - Rate this topic

DataServiceContext.CancelRequest Method

Attempts to cancel the operation that is associated with the supplied IAsyncResult object.

Namespace:  System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)
public void CancelRequest(
	IAsyncResult asyncResult
)

Parameters

asyncResult
Type: System.IAsyncResult
The IAsyncResult object from the operation being canceled.

The IAsyncResult object passed to the asyncResult parameter is the object returned when an operation is executed asynchronously. For more information, see Asynchronous Operations (WCF Data Services).Until this request is processed, the DataServiceContext instance is not in a predictable state. The DataServiceContext can be safely used when the IsCompleted property of the asyncResult returns a value of true.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Code Sample for CancelRequest
IAsyncResult currentQueryInFlight = Context.BeginExecute<Customer>(customerRequestUri,Callback,userState);
//Call the CancelRequest API on the DataServiceContext instance to cancel the request 
Context.CancelRequest( currentQueryInFlight );