everyone
The problem is if there exists two exported components which have the same export signature but only one should be imported ( this is possible, the practical example is install new plugin to replace the old one without uninstall the old one. ). We can provide a configuration file to tell which component should be imported, but the question is how to tell MEF the right selection?
I have three methods:
Use a custom catalog, filter the available plugins. But suppose the situation that A imports component A and B imports component B while the component A and B have the same export signature. A custom catalog cannot handle this except we create new custom catalog for each component.
Interception in MEF composition. I am not sure if it is possible and I don't know how. But if there's a way let us intercept in composition process, this could be the best one.
Use a import wrapper instead of real interface. When the component is constructing, it will initialize the wrapper and let the wrapper handle the selection logic ( such as prompt a window and let user select one or read configuration )