I've been brainstorming this one. I am using the Caliburn.Micro.HelloScreens as my starting point. In it there are 2 viewmodels (CustomerViewModel) and (OrderViewModel) implemented with corresponding IWorkspace exports for MEF.
What I am trying to do in the Bootstrapper (ScreenBootstrapper.cs) is set the
batch.AddExportedValue<Func<CustomerViewModel>>(() => container.GetExportedValue<CustomerViewModel>());
batch.AddExportedValue<Func<OrderViewModel>>(() => container.GetExportedValue<OrderViewModel>());
What I am trying to do in the Bootstrapper (ScreenBootstrapper.cs) is set the following instead:
batch.AddExportedValue<Func<IModule>>(() => container.GetExportedValue<IModule>());:
But when I set the CustomerVewModel.cs and OrderViewModel.cs to export as IModule; they don't seem to load when the app runs.
I must admit I am new to MEF and Caliburn.Micro so I must be missing something.
Please note that if I create external assemblies for the 2 implementations <Customer> and <Order> and add the assemblies in my IEnumerable<Assembly> SelectAssemblies(); it works great but my main goal is not use these as external assemblies
but integrated in the current project.
I'm just hoping they don't have to be spelled out batch.AddExportedValue<>() for each ViewModel used for business services.