New Posts New Posts RSS Feed: Coroutine and navigation property retrieval
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Coroutine and navigation property retrieval

 Post Reply Post Reply
Author
JoschaMetze View Drop Down
Newbie
Newbie


Joined: 28-Jul-2011
Posts: 2
Post Options Post Options   Quote JoschaMetze Quote  Post ReplyReply Direct Link To This Post Topic: Coroutine and navigation property retrieval
    Posted: 28-Jul-2011 at 1:47am

Hi folks,

is there a way to retrieve a pending navigation property entity in a coroutine without just requerying the entity itself?

My situation is the following:

Entity A has a navigation property B

Entity A is loaded and property B is needed inside a serial coroutine.

I didn't find any method to return the necessary  IEnumerable<INotifyCompleted> for my navigation property. Using the PendingEntityResolved event doesn't help much in a coroutine as it breaks the serial flow.

Any ideas?

Kind regards

Joscha

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: 28-Jul-2011 at 8:11am
Could you use an Include in your original query?

Or could you do something like this in your other coroutine?

EntityQuery<EntityB>.Where(b => b.EntityAId = 123)

This will bring it into cache so you can then do A.B
Back to Top
JoschaMetze View Drop Down
Newbie
Newbie


Joined: 28-Jul-2011
Posts: 2
Post Options Post Options   Quote JoschaMetze Quote  Post ReplyReply Direct Link To This Post Posted: 28-Jul-2011 at 8:21am

Hi,

unfortunately I cannot use Include as the Entity is queried in another place where I don't know if I will need my navigation property (and even worse, with an EntityKeyQuery).

Of course I could use a Query but that was what I was trying to avoid in the first place cause it seems rather unclean as I am coupling my entities in code and need to have knowledge of the child/parent relationship.

I wouldn't even need a navigation property for that, so the short answer would be no navigation properties in coroutines without making assumptions about them being fetched beforehand.

But I will have to stick to that if there is no sugar coat solution :).

Thanks and regards

Joscha

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: 28-Jul-2011 at 11:12am
Unfortunately there's no sugar coated solution within DevForce itself :).  I'm not sure why the PendingEntity resolution doesn't implement INotifyCompleted, but another option, albeit with even more work than the above, is to create your own "Operation" class which implements INotifyCompleted and wraps the retrieval and event handling for the pending entity.  There are a few examples of custom operations in the IdeaBlade Application Framework available at http://devforcecaliburn.codeplex.com/, specifically the XapDownloadOperation there is a good example of a custom operation.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down