New Posts New Posts RSS Feed: TempHire and Cancellation Tokens
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

TempHire and Cancellation Tokens

 Post Reply Post Reply
Author
murray.bryant View Drop Down
Groupie
Groupie


Joined: 11-Jan-2012
Location: Australia
Posts: 44
Post Options Post Options   Quote murray.bryant Quote  Post ReplyReply Direct Link To This Post Topic: TempHire and Cancellation Tokens
    Posted: 03-Feb-2013 at 5:41pm
Hi

I am currently working through the patterns in the temphire application to implement a new solutions.

My question is with all of the viewmodels separated and each handling their own async data connections  how do you recommend I share a cancellation token between them all?

I can't see temphire implementing this anywhere. And from my perspective this is a huge requirement to stop the application crashing often as the user clicks through data rich interfaces.

thanks

Murray
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 03-Feb-2013 at 7:16pm
Are you using busy indicators to stop users from performing actions while an async method is running?
Back to Top
murray.bryant View Drop Down
Groupie
Groupie


Joined: 11-Jan-2012
Location: Australia
Posts: 44
Post Options Post Options   Quote murray.bryant Quote  Post ReplyReply Direct Link To This Post Posted: 03-Feb-2013 at 8:34pm
No I am not

But that is also not a solution in my mind.

The page is designed to load up async independently. ( multiple view models)

If the user then wants to change the data source of the base viewmodel ( ie a different base entity) then the whole process should cancel gracefully then start again. Locking up the interface would not be a good user experiance in this case

This is what the cancellation tokens are for. What I am wondering is what is the best practice for doing this using the base of temphire/cocktail framework




Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 03-Feb-2013 at 10:08pm
Murray,
You might be too optimistic with your understanding of the cancellation token. The cancellation token is only a request to cancel an operation. There's no guarantee that the request is processed in time or processed at all. For example in DevForce, once a query is sent to the server it can no longer be cancelled. In addition if you let the user proceed before all the data is loaded you risk older queries overwriting the results of newer queries, because there is no guarantee that the results arrive in the same sequence as the queries were executed. What this means is that your UI has to be prepared to receive results out of sequence and results that are no longer needed. Both cases can be dealt with by using sequence numbers to correlate the results to the original queries and decide whether the results should be discarded. Using a cancellation token to attempt to cancel the queries will buy you very little. You still have to deal with out of sequence results and results that were sent to the client because the cancellation request came in too late.
 
These concerns are not there in the latest version of TempHire, because it doesn't reuse ViewModels when the user changes the root entity, so there is no risk of out of sequence results. As you've probably noticed, TempHire doesn't prevent the user from selecting another staffing resource while the previous one is still loading, but because it loads each staffing resource into a new detail composition, it doesn't have to deal with the above.
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down