New Posts New Posts RSS Feed: First Silverlight Use
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

First Silverlight Use

 Post Reply Post Reply
Author
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Topic: First Silverlight Use
    Posted: 11-May-2011 at 8:53am
I have developed many WPF and Windows apps. This is my first time really using Ideablade with SL.
 
I have run an async query to recieve and entity. Some of the attached entities return detached or null. Do I have to do an Include with all of my async queries?
So basically lazy loading doesn't seem to work. Should it?


Edited by orcities - 11-May-2011 at 9:02am
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: 11-May-2011 at 9:34am
I usually use an Include but I believe it should IsNullOrPendingEntity and an event PendingEntityResolved should fire when it's lazy loaded.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 11-May-2011 at 9:48am
I guess that makes since. I am just used to it lazy loading. So in order to do lazy loading i have to fire the event to raise the changes?
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: 11-May-2011 at 9:50am
If you are databinding to the list then it should just fill in when it loads. Using an include would be the recommended approach though.
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: 12-May-2011 at 10:42am
I just wanted to expand on what smi-mark said since this is a confusing topic and often causes problems for people new to Silverlight. 
Lazy loading occurs by default in both Silverlight and non-Silverlight DevForce applications, but in Silverlight that load has to be asynchronous because the data has to be fetched from the server.  You don't need to fire any events, and you don't need to listen for the Pending* events unless you want to.
 
Using "Include" means you're doing "eager" loading, and can often be useful when you need an object graph. 
 
The Tour of DevForce Silverlight has a nice example of lazy vs. eager loading and may be worth a look.  You can find it here (and I highly recommend the entire video series) - http://drc.ideablade.com/xwiki/bin/view/Documentation/tour-devforce-silverlight
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down