Similar to the discussion at http://mefedmvvm.codeplex.com/discussions/215926, I needed to integrate Prism with MEFedMVVM but it wasn't acceptable to have two composition containers being created. This patch allows MEFedMVVM to accept a composition container created externally (in my case, by Prism). My application bootstrapper now looks like this:
public class Bootstrapper : MefBootstrapper, IComposer, IContainerProvider
{
private CompositionContainer _compositionContainer;
// Other stuff omitted for clarity
protected override CompositionContainer CreateContainer()
{
// The Prism call to create a container
var exportProvider = new MEFedMVVMExportProvider(MEFedMVVMCatalog.CreateCatalog(AggregateCatalog));
_compositionContainer = new CompositionContainer(exportProvider);
exportProvider.SourceProvider = _compositionContainer;
return _compositionContainer;
}
CompositionContainer IContainerProvider.CreateContainer()
{
// The MEFedMVVM call to create a container
return _compositionContainer;
}
}
So you can see, I only have one CompositionContainer now.