Navigation to Dynamic Modules

Topics: Prism v4 - Silverlight 4, Prism v4 - WPF 4
Mar 31, 2014 at 1:06 AM
Edited Mar 31, 2014 at 3:45 PM
In WPF and Silverlight, if you provide a URI that includes a satellite assembly, the navigation subsystem will load that module and then navigate to it. For example:
Navigate("pack://application:,,,/MyAssembly;/MyFrame?path=\Root");
Will find MyAssembly, load it, then find the type "MyFrame" in that assembly, create an instance of the type and load the instance as the content.

I've found no such analog in Prism 4.1. Navigation appears to work only with pre-loaded types. In addition, if you try to supply the assembly name, then Prism can't seem to resolve the type reference without jumping through hoops when registering the view. I've had to roll my own dynamic module loader (which was fairly easy to do with the Prism plumbing), but I'm left wondering: why isn't this baked into Prism? Am I missing something fundamental?
Mar 31, 2014 at 7:18 PM
Hello DRAirey1,

Based on my understanding, Prism's RequestNavigate() method would not register or load type names. It actually works with View key names which would be registered before in the container.
Therefore, adding the capabillity you described it would be causing for this method to handle a new different behavior, without considering the Single Responsibility Principle and possibly generating confusion on its complete job.

However, you could add this suggestion into the Issues section so the P&P Team would consider this feature for implementing it on future releases.

Regards.

Gabriel Ostrowsky.
https://blogs.southworks.net/gostrowsky
Apr 7, 2014 at 1:19 AM
Gabriel,

A URI is a "UNIVERSAL" resource identifier, meaning it contains all the information needed to locate a resource in your application. In the .NET world, that includes the assembly in which a type resides. If I have loosely coupled modules, then I need to know which module contains a given type before I can navigate to it.

What astounds me is that this is baked into WPF and Silverlight navigation. Why would you make your framework less functional than the one it's supposed to be replacing?

Don
Apr 7, 2014 at 7:10 PM
Hi Don,

Prism may differ on how some features are achieved, as it have a custom particular workflow.
View-Based Navigation is the type of Navigation on which you go from one View to another. But this Navigation feature would be performed limited into the list of registered Views inside a specific Region. This way you could Navigate independently on each defined Region.

The following MSDN Prism chapters may answer your question about Prism design architecture, specially the last two regarding Navigation:

Regards,
Gabriel Ostrowsky.
https://blogs.southworks.net/gostrowsky