Cancellation of query execution in ADO.NET Data Service from client RRS feed

  • Question

  • Hi,
          In my Silverlight application(or typical Windows/WPF Application), I need to run long running queries. There are scenarios where user needs to cancel the long running query. How can this be achieved with ADO.NET Data Services client?

    Madhanmohan S
    Madhanmohan S from India
    Wednesday, June 3, 2009 4:57 AM

All replies

  • Once you kick off the query , you can hold the IASYncREsult returned from the BeginExecuteCall .
    and then Call CancelREquest on the dataServiceContext instance to cancel the request.
    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Wednesday, June 3, 2009 6:53 PM
  • Phani, thanks for your answer but can you code some example, please?

    Thanks :)
    Wednesday, June 3, 2009 10:00 PM
  • Here you go ,

     IAsyncResult asyncResult = context.BeginExecute<Customer>( new Uri("/Customers"), QueryCallback,state );
    You will need to stash the asyncResult around if you want to cancel the request.
    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Thursday, June 4, 2009 5:57 AM
  • Is this feature soported in ado.net data service 1.0? Because I can't find the context.CancelRequest method.

    Thanks :)
    Thursday, June 4, 2009 7:40 AM