New Posts New Posts RSS Feed: ShouldLoadEntityRefs
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

ShouldLoadEntityRefs

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

Joined: 05-Aug-2009
Posts: 22
Post Options Post Options   Quote robdrye Quote  Post ReplyReply Direct Link To This Post Topic: ShouldLoadEntityRefs
    Posted: 30-Dec-2009 at 4:18am
I have been unable to get the ShouldLoadEntityRefs behavior to work as expected in the SL environment.  I have a simple scenario where a parent entity gets loaded from a sproc and a collection of its child entities gets loaded directly from a db table.  When executing this scenario (and identical code) inside the regular .NET environment everything works as expected - the parent gets loaded along with the collection of its child entities however when switching over to SL the child entities collection consistenly comes back empty. 
 
Thanks for your help.
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 05-Jan-2010 at 10:43am
In Silverlight, all data retrieval is done asynchronously. A collection of child entities will initially show as empty, but you can set up a handler for the collection navigation property's PendingEntityListResolved event to receive notification when the entities have been retrieved into the cache. Are you doing that?

It is also possible to bind the collection navigation property to UI controls (e.g., a DataGrid), in which case the UI controls will be notified when the collection to which they are bound changes and will automatically refresh.
Back to Top
robdrye View Drop Down
Newbie
Newbie
Avatar

Joined: 05-Aug-2009
Posts: 22
Post Options Post Options   Quote robdrye Quote  Post ReplyReply Direct Link To This Post Posted: 12-Feb-2010 at 9:27am

Thanks for the response Greg and sorry I did not follow up sooner.

Revisiting the PendingEntityListResolved event uncovered our issue and more importantly made us realize that our initial approach to the data fetch scenario mentioned in this post was far from ideal.  We were able to refactor a few things and simplify our approach back to just using straight DF LINQ queries.
 
Thanks again for your help.
 
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 12-Feb-2010 at 3:09pm
You're quite welcome, Rob! Straight LINQ sounds good! 8-)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down