IdeaBlade DevForce 2010 Help Reference
CancelAsync Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityManager Class : CancelAsync Method



userState
Token identifying the operation to cancel.
Cancel a pending asynchronous operation.

Syntax

Visual Basic (Declaration) 
Public Sub CancelAsync( _
   ByVal userState As Object _
) 
Visual Basic (Usage)Copy Code
Dim instance As EntityManager
Dim userState As Object
 
instance.CancelAsync(userState)
C# 
public void CancelAsync( 
   object userState
)
C++/CLI 
public:
void CancelAsync( 
   Object^ userState
) 

Parameters

userState
Token identifying the operation to cancel.

Example

C#Copy Code
public void CancelAsyncSample() {
  // Sample showing cancel of an async fetch operation.

  DomainModelEntityManager mgr = new DomainModelEntityManager();

  var query = mgr.Customers.With(QueryStrategy.DataSourceOnly)
    .Where(c => c.CompanyName.StartsWith("A") || c.CompanyName.EndsWith("a"));
  Guid token = Guid.NewGuid();

  // Start an async fetch
  var op = mgr.ExecuteQueryAsync<Customer>(query, (e) => {
    MessageBox.Show(e.Cancelled.ToString());
  }, token);

  // And now cancel it.
  op.Cancel();
}

Remarks

Use the same token passed to the asynchronous call to indicate the operation to be cancelled.

Note: To cancel a Login or Logout operation, call the Cancel method on the operation returned by the asynchronous call.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.