Visual Basic (Usage) | ![]() |
---|---|
Dim instance As EntityManager Dim userState As Object instance.CancelAsync(userState) |
Parameters
- userState
- Token identifying the operation to cancel.
C# | ![]() |
---|---|
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(); } |
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.
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