Make Imports available

Nov 17, 2009 at 1:03 PM
Edited Nov 17, 2009 at 2:22 PM

Hi Guys.

I wrote a Custom Catalog to make Exports from an IoC Container available in CompositionContainer.

Now i want to make Imports from IoC Container available in CompositionContainer.


The Question is: How can i make Imports from a IoC Container available in MEF?

The problem is that if MEF needs some Exports, it call the method

<font size="2" color="#0000ff"><font size="2" color="#0000ff">


</font></font><font size="2" color="#0000ff">



virtual IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)

from the ComposablePartCatalog.

But there is no method to get the Import for a given Export.

How can i solve this?


For example i have one xml-File which define one component with one export, and a second xml-File which define one component with one import.

Now i want that mef makes the connection between these two components with my CustomCatalog.


Thanks for response

Nov 18, 2009 at 8:58 PM

ComposablePartCatalog.GetExports is a simply shortcut method to get all the Exports. You can simply traverse ComposablePartCatalog.Parts to get the full list of Exports and Imports.

Nov 30, 2009 at 3:52 PM

see whether it help you