Download modules without initializing them

Topics: Prism v4 - Silverlight 4
Jul 19, 2010 at 4:24 PM
I have several modules set to InitializationMode OnDemand. From my understanding they will be downloaded and loaded on demand. Is there a way to set a module to InitializationMode OnDemand but have them downloaded automatically when the bootstrapper runs ? I want them to be available on the client but not initialized Thanks
Jul 19, 2010 at 6:39 PM

The download and initalization were intentionally tied together in previos versions of Prism.  This allowed things to be a bit simpler both from an external usage perspective (less concepts to learn and keep track of), and for simplicity in the implementation.  We did consider the scenario, but had not recieved many requests for it, so it has been quite low on the priority list.

I would like some more information on your scenario and what the challenges you are running into that make this a necessary feature for you.  Would you mind sharing a bit more about what you are trying to do and the motivations behind it? It may help us better understand the needs for this so we can prioritize it appropriately.

In the short run, there are two things I can think of that could enable this now:

  • Have a XAP that contains a module that is initialized at application startup.  In that XAP, add the other, on demand modules.  This is ugly, and depending on the scenario and the size and number of modules involved, could cause more problems than it solves.
  • Introduce a delayed initialization concept in your app.  During the Prism provided module initialization, do the bare minimum, and have your module subscribe to a service that does on demand inialization when you request it.  Again, not completely straight forward, but it should work.

I hope that helps,

Michael Puleio

Jul 19, 2010 at 9:10 PM
Edited Jul 19, 2010 at 9:12 PM

I'll try and describe our scenario.

We're developing a very large Silverlight enterprise application. Currently the application consists about 10 modules and this is very likely to grow in the near future. All modules should be available to the users once they pass through a login/authentication process.

After the authentication process has been completed there are a bunch of state full services/managers that need to be initialized before the other modules load (these services vary depending on the user that has been authenticated). This is because these modules depend on these services. So basically what we did was to set all modules (except for the authentication module) to on demand initialization. Once the user has been authenticated we load all the services, and when these services have been initialized we load all the modules via the module manager manually. However this results with an odd delay since all the modules are being downloaded from the server at this point.

As for your solutions, well the first one I think the R&D department would execute me if I even suggested it :-)

The second one is a little more practical but it would require quite a bit of work to our infrastructure.

Anyways, thanks for your help.

Jul 20, 2010 at 5:54 PM

Thanks for the info on the scenario.  I'll take this back to the rest of the team.