Print Page | Close Window

Canceling all queries in unit of work

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3392
Printed Date: 19-Oct-2019 at 12:09am


Topic: Canceling all queries in unit of work
Posted By: JohnBloom
Subject: Canceling all queries in unit of work
Date Posted: 16-Apr-2012 at 10:06am
We have a process that uses unit of work and can run many serverside tasks at a time. We want the user to be able to click cancel and for that to cancel all of the queries for the unit of work. How should we go about that?

-------------
-John Bloom



Replies:
Posted By: mgood
Date Posted: 16-Apr-2012 at 5:46pm
There isn't a way to cancel all running queries on an EntityManager. In the unit of work, you basically have to keep track of your queries and then for each query you call EntityManager.CancelAsync(userState). Every asynchronous method in DevForce has a signature that lets you specify the userState. For example this could be a sequence number you keep incrementing. The userState also comes back in the corresponding event args of the Completed event, so you can remove an operation from your list once it completes.



Print Page | Close Window