Hi, i starting to use MEF, and i have a class with multiple constructors, like this:
[Export(typeof(ifoo))]
class foo : ifoo {
void foo() { ... }
[ImportingConstructor]
void foo(object par1) { ... }
}
i am using catalog.ComposeExportedValue() when composing to suply the par1 value to 2nd constructor:
...
catalog.ComposeExportedValue(par1Value);
catalog.ComposeParts(this);
...
To hold the components i using:
[ImportMany(typeof(ifoo))]
public List<Lazy<ifoo, ifoometadata>> FooList { get; set; }
And to create the foo instance i using the Value property (FooList[0].Value).
Everthing works fine, except that the 2nd constructor of the foo class is never called, what's wrong?
How do i select the constructor i want to use when MEF instantiates the class?