How to split Hello.Screens into Modules

Topics: Bootstrappers & IoC
Oct 1, 2011 at 3:11 AM

Hi 

I am new MEF and caliburn.micro and am trying to implement a framework for an application based on the Hello.Screens application but split up into modules ( with workspace in each separate xap file)

I have having issues with the fact that the 

batch.AddExportedValue<Func<CustomerViewModel>>(() => container.GetExportedValue<CustomerViewModel>());

code in the bootstrapper runs before the CustomerViewModel is added to the Catalog.

I know I need to manually add the xaps to the catalog. But I can't for the life of me work out how to do it. 

There seems to be no examples anywhere of how to make this work. Which leads me to think I am missing something obvious.

If someone can point me in the right direction I would be very grateful

thanks

Murray

Oct 2, 2011 at 11:56 PM

Are you modules dynamically loadable/composable?
If not, you just have to override SelectAsseblies in your bootstrapper (starting from something along this sample in the doc), enumerating each statically linked assembly containing an app modules.
If, otherwise, modules are composed at runtime and not statically linked, you have to add one or more DeploymentCatalog to the root AggregateCatalog.
You also have to make sure that all subsequently loaded assemblies get registered into AssemblySource, otherwise CM will not inspect when searching for Views.

You may also want to have a look at this recipe, aimed to asynchronously load external xap just when needed.

Hope it helps.

Oct 3, 2011 at 11:15 AM

I did a refactoring on that sample earlier. Look at http://caliburnmicro.codeplex.com/discussions/259776. I also forked the sample https://hg01.codeplex.com/forks/syggen/decoupledhelloscreens. I don't remember how it ended but I think it could help you get some ideas at least.

Hope it helps.