MEF Constructor Parameters with Multiple Constructors

后端 未结 2 1531
终归单人心
终归单人心 2021-01-12 07:04

I\'m starting to use MEF, and I have a class with multiple constructors, like this:

[Export(typeof(ifoo))]
class foo : ifoo {
    void foo() { ... }
    [Imp         


        
2条回答
  •  醉梦人生
    2021-01-12 07:40

    Are you passing an instance of the foo class into the ComposeExportedValue method? In that case the object has already been constructed and the constructor can't be called again, so MEF will ignore the constructor imports.

提交回复
热议问题