I'm researching MEF as a solution to plug-in resolution in our existing .NET Application.
In all of the examples that I can find, the main application creates an instance of the CompositionContainer and calls container.ComposeParts(this).
The problem is, my application is not entirely built on MEF, so there is a hole in the object graph where there are no MEF components. So my object hierarchy might look like this:
Application (MEF Container) -> ObjectB (no MEF) -> ObjectA (requiring MEF Imports)
In this object hierarchy, it's impossible for me to call container.ComposeParts(this) on the application and expect the application to create ObjectB and satisfy ObjectA's Imports.
Is it a good practice to expose the CompositionContainer globally so I can compose ObjectA at a later time than on Application Startup or do I have to restructure my entire application to support a linear MEF object graph?