New Posts New Posts RSS Feed: Async property navigation and Exceptions
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Async property navigation and Exceptions

 Post Reply Post Reply
Author
jbiddle61 View Drop Down
Newbie
Newbie


Joined: 18-Dec-2012
Location: Arizona
Posts: 24
Post Options Post Options   Quote jbiddle61 Quote  Post ReplyReply Direct Link To This Post Topic: Async property navigation and Exceptions
    Posted: 05-Nov-2013 at 4:26pm
If I enable async property navigation in my EntityManagers (like TempHire), is there anyway to get notified of any exceptions that are thrown?

I have my database access through a web service (n-tier).
I set a breakpoint just before the access of the navigation property.
When the breakpoint is hit, I stop the web service, and let the program continue.
My PendingEntityResolved event handler never gets called (as expected), but there does not seem to be an exception raised either.

Is there anyway to detect database errors when using async property navigation?
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2013 at 10:42am
Unfortunately the Pending*Resolved event args don't contain error information, but you can listen on the EntityManager's Queried and EntityServerError events to receive error information.  If you've also lost connectivity, the ConnectionStateChanged event will fire too.
Back to Top
jbiddle61 View Drop Down
Newbie
Newbie


Joined: 18-Dec-2012
Location: Arizona
Posts: 24
Post Options Post Options   Quote jbiddle61 Quote  Post ReplyReply Direct Link To This Post Posted: 07-Nov-2013 at 2:27pm
Thanks, Kimj - that helps some.

So I setup an EntityManagerDelegate to handle these.
So far, so good - if I deliberately cause a database error during async navigation, the event does get passed to my delegate.

The problem I now have is that need some was to determine if I want to handle the error in the delegate or allow it to be passed on.

Basically I need to be able to tell if the exception came from async property navigation or not.
If it comes from async property navigation, I want to handle the error in the delegate; otherwise I want to let the error continue on its merry way and handle it where I am awaiting the async call.

Is there some way to do that?
Or, better yet, is there some way to actually await the async property navigation?

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 07-Nov-2013 at 5:49pm
It would be ideal if the pending entity API used the same async/await pattern as other asynchronous methods in DevForce, but we haven't implemented this yet.
 
Right now, although it's ugly, you can check the Query in the EntityQueriedEventArgs - it will be an EntityRelationQuery for any navigation-based query.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down