New Posts New Posts RSS Feed: EntityReferenceBase.Load within a coroutine
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EntityReferenceBase.Load within a coroutine

 Post Reply Post Reply
Author
bebe View Drop Down
Newbie
Newbie
Avatar

Joined: 11-Feb-2010
Location: Austria
Posts: 6
Post Options Post Options   Quote bebe Quote  Post ReplyReply Direct Link To This Post Topic: EntityReferenceBase.Load within a coroutine
    Posted: 22-Nov-2010 at 5:16am
I use
manager.UseAsyncNavigation = true
;
manager.DefaultQueryStrategy = QueryStrategy.CacheOnly;

and call
EntityReferenceBase.Load(MergeStrategy mergeStrategy) to load a related entity.

In NorthwindDB this could look like:

var reference = Territory.PropertyMetadata.Region.GetEntityReference(territory);
reference.Load(MergeStrategy.PreserveChanges);


I would like to do this within a coroutine. How can I get informed that the operation is completed (e.g. the Region of the Territory is loaded)?

It would be great if EntityReferenceBase.Load(...) would return a INotifyCompleted. Are there any plans for this feature?


Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 30-Nov-2010 at 12:23pm
Hi bebe,
 
Unfortunatelly, you won't be able to accomplish that with EntityReferenceBase.Load in a coroutine.
 
Is there any particular reason you are using EntityReferenceBase.Load instead of EntityRelationQuery?
You'll be able to complete the same task using EntityRelationQuery with the plus of being able to use it in a coroutine.
 
For instance:
 
  ...
  var regionERQuery = new EntityRelationQuery(territory, EntityRelations.FK_Territory_Region.ToRole2Link);
  var regionQuery = regionERQuery
    .With(myQueryStrategy)
    .ExecuteAsync();
  yield return regionQuery;
  ...
 
Regards,
   sbelini.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down