Monday, 26 August 2013

How do I identify my own parts in an MEF catalogue?

How do I identify my own parts in an MEF catalogue?

Following the article Create composite modular UI application in WPF using
MEF and PRISM, I have the WPF application as instructed, and my view
injected into a region on the main window works fine. However, for the
module project that exports MEF Parts, I have set the output directory to
a parts repository directory somewhere. When I build the solution, my
ModuleA.dll gets placed in that directory, but with all it's dependencies.
I use a DirectoryCatalog on that parts repo directory, and it contains 26
parts, only 1 of which is mine. I would like to extract a list of parts
that are mine from that directory, not using raw reflection myself, e.g.
not by examining assemblies and building an AssemblyCatalog. Is there any
way I can call Parts on the directory, and examine the exports to see
which is mine? If I browse the catalogue, I can see my Part, but I can't
see any properties I can examine to do this grammatically.

No comments:

Post a Comment