Tuesday, April 5, 2011

Silverlight Architecture Guidance - Lazy Loading

Background: We have an offshore group working up a Silverlight 2 prototype for us. There is the conception that we need to be very concerned with lazy loading of various "screens"/parts of the application. The offshore group has decided to dynamically load assemblies in order to achieve this; however, I would think MS has already dealt with this issue.

Question: Does Silverlight already deal with loading assemblies in an intelligent manner or is that something that we will have to be concerned with?

From stackoverflow
  • Silverlight does have a built in ability to fetch various bits of the application in an on demand basis. However all these bits would be listed initially in the manifest.

    However I suspect your partners are thinking in terms of dynamically determining new chunks of the application being downloaded and displayed even after the intial xap has been built.

    I don't think you should be too concerned about this, its not actually excessively difficult to achieve.

    brendanjerwin : Not concerned with dynamically adding new parts. We will redeploy the whole app if there is new functionality. I believe the concern is completely about performance. i.e. excessive startup time downloading the whole app at once.
  • Cut+paste from my existing answer on another question.. Jesse Liberty has some decent tutorials on multi-page Silverlight apps:

    Tutorial and Update

    You can make your initial app nothing more than a basic "stub" and then load the other bits once you at least have some GUI available. Doesn't come out of the box, but it's straightforward to do.

    brendanjerwin : But the question is: DO I want to? Is it something that should be done? And why?
    Steven Robbins : Well that's entirely up to you. How big is the payload going to be if it's all in one? How long will that take to download? Is that an acceptable time for a user to see "nothing"? These are the questions that dictate whether or not to lazy load them or not.
  • Tim Heuer has a good video explaining how you can dynamicly load assemblies at runtime:

    http://silverlight.net/learn/learnvideo.aspx?video=65687

    There should also be a version of the Prism toolkit from the Microsoft PnP people sometime in the 1st quarter that will help with that.

    Steven Robbins : There's something very wrong when I have more up votes on a Silverlight question than Shawn Wildermuth does :-)

0 comments:

Post a Comment