Martijn's blog - E-Commerce, EAI, BizTalk and .NET

2006/11/02

CAB: load your modules from your App.Config

In CAB, there's a 'special voodoo magic' file which defines which modules are to be loaded in the IoC process. The file is called ProfileCatalog.xml by default.

We're currently using CAB in combination with an XBAP application. This leads to deployment issues, as ProfileCatalog.xml will be deployed in to a folder called Data by default and the modules configured in the file cannot be located. You can work around this issue, but I took the issue as an opportunity to replace the default implementation of IModuleEnumerator in CAB with my own.

My implementation looks at the App.Config file for it's modules. All that's needed to use the new enumerator is to configure it:
<configSections>
 <section 
  name="SolutionProfile" 
  type="BankTellerModule.Services.ModulesSection, BankTellerModule" />
 <section 
  name="CompositeUI" 
  type="Microsoft.Practices.CompositeUI.Configuration.SettingsSection, Microsoft.Practices.CompositeUI" />
</configSections>

<CompositeUI>
 <services>
  <add
   serviceType="Microsoft.Practices.CompositeUI.Services.IModuleEnumerator, Microsoft.Practices.CompositeUI"    instanceType="BankTellerModule.Services.ConfigurationModuleEnumerator, BankTellerModule" />
 </services>
</CompositeUI>

<SolutionProfile>
 <Modules>
  <add assemblyFile="BankTellerModule.dll" />
 </Modules>
</SolutionProfile>

The code for this behaviour will be available here in a few hours...

1 Comments:

Post a Comment

<< Home