Question

I have a WPF application where a significant portion of the views will not be used on a daily basis - think maintenance windows. My thought was that moving the views and view models for those windows into a separate assembly that is only loaded when one of them is displayed would improve startup time and reduce the memory footprint of the application.

First off, is this a reasonable thing to do?

If so, what is the best 'Catel' approach to accomplishing this? I can use MEF, but it does not seem to support delay loading the assembly out of the box; it loads the assembly when the catalog is built. Does Unity allow for delay loading? Does Catel's ServiceLocator/DependencyResolver?

Was it helpful?

Solution

There is no need to "lazy-load" assemblies with views because views are not preloaded by Catel. Catel will lazy-load views when they are needed and cache the results. This means that there will be a minor (not noticeable) impact the first time a view and view model are loaded.

The only reason to put views / view models in a separate assembly is for separation of concern / keep your assemblies manageable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top