Extended Module Loader Service

Introduction

The extended module loader service can be used to load modules on demand. When the module loader service loads a module it will check if the module being loaded is actually installed and install it from the original installation source.

Required MSI structure

To use this module loader service you have to use a specific feature structure in your Windows Installer installation package.
Each module requires a feature in the installation package with the same name.

Also be sure to save the product code used in the installer package in the application so that it can be provided to the extended module loader service.

How to use the service

To use the service register it with the UnityContainer using the following piece of code:

Container.RegisterInstance<IExtendedModuleLoaderService>(Container.Resolve<ExtendedModuleLoaderService>());
IExtendedModuleLoaderService service = Container.Resolve<IExtendedModuleLoaderService>();
service.ProductCode = "{SOME GUID}";

Container.RegisterInstance<IExtendedModuleLoadService>(service);


Loading a module on demand can be done by invoking one of the following methods:

Container.Resolve<IExtendedModuleLoadService>().LoadModule("ModuleName");

//Specify false if you don't want to install the module on demand
Container.Resolve<IExtendedModuleLoadService>().LoadModule("ModuleName",true); 

More information

More information on the internals of the custom module loader service can be found here: http://blogs.infosupport.com/blogs/willemm/archive/2008/07/28/CompositeWPF-_1320_-Installing-modules-on-demand.aspx

Last edited Jul 28, 2008 at 7:35 PM by WMeints, version 4

Comments

No comments yet.