I'm trying to use the MEF ImportingConstructor in my class, and while I've used MEF successfully in the past, I've always started with creating the CompositionContainer to assemble all the exports.
What container does the ImportingConstructor use to satisfy it's imports?
You still need to create a container and either supply the exports yourself or supply catalogs to identify how to find the exports. Once those are provided, the imports are resolved from the container used to get the exported value.
So if you have:
[Export]
public sealed class A
{
}
[Export]
public sealed class B
{
[ImportingConstructor]
public B(A a)
{
}
}
Then you call container.GetExportedValue<B>()
, it will look in the catalog to find the export for B, then find the importing constructor, then try to resolve the import for A. Assuming that class A is part of your available exports (either added explicitly or, more typically, part of a catalog), it will then get the exported value of A (possibly constructing it) and use that to construct B.
Assuming that your confusion is over the catalogs part of this, check out this guide. Basically you just need to add catalogs for the assemblies whose exports you want exposed.