New Posts New Posts RSS Feed: Lazy Load on Many to Many
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Lazy Load on Many to Many

 Post Reply Post Reply
Author
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Topic: Lazy Load on Many to Many
    Posted: 25-Jan-2012 at 2:56pm
SilverlightApplication24.zip

I have a Page with Two Grids on it. On the left is a Grid of Entities. On the right is a grid which shows items related to the Entities on the left. In other words, Navigational Items.

This is wired up and it works ok.

However, the navigational items is actually a many to many link. So the links show, but it's just an id of the actual Entity that I want to show.

ParentEntity -> LinkingEntity -> actual entity.

The only way I could come up with to Bind all the way down to the actual entity was to add custom properties to the Linking Entity that match the actual entity properties. The linking entity has a navigational property to the actual entity so I can retrieve the actual properties through it.

And this works, sort of. It shows the actual properties, but it requires clicking around in the left grid to get the properties in the right to be lazy loaded. The linking entities are propertly loaded, but not the actual entity. After clicking around, it does trigger the lazy load, but it should just be loaded from the start.

Attached is a project that shows this. It connects to a database which I can make available, but it was too big to post on the forum.

One solution on this that I did find was to do an include so the actual entities are downloaded from the start instead of lazy loaded. But there will be too many of the entities to do this at production time, so we are trying to get lazy loading to work.

Also note that I tested this with both the Telerik grid, as well as the Toolkit grid, and they both product the same result. The result is that the actual entities are not loaded initially. When you click on a different row on the right, a two out of the three actual entities are loaded. Clicking back and forth in the left grid finally results in them all being loaded on the right.

Thanks,
Greg
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: 26-Jan-2012 at 5:30pm
Hi Greg,
 
Since navigation properties are retrieved asynchronously in Silverlight, you should use the PendingEntityResolved and PendingEntityListResolved events.
 
You can find detailed information about asynchronous navigation properties in the DevForce Resource Center.
 
I'm also attaching a simple solution (based on yours, but using NorthwindIB) that uses lazy loading to populate the right grid.
 
Regards,
   Silvio.
Back to Top
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Posted: 27-Jan-2012 at 6:29am
Great, thank you very much.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down