I'm using MEF in my WPF application, and I'm not sure if my exports are not making it into the container because of the way I'm exporting them, or because of the way I'm querying the container.
Here's my object hierarchy:
public interface ICommonInterface
{ }
[InheritedExport]
public abstract class CommonBaseClass<T> : ICommonInterface
{ }
public Class1 : CommonBaseClass<Class1>
{ }
public Class1 : CommonBaseClass<Class2>
{ }
I'm using the implementation of T in the base class for reasons outside the scope of the question; that's why it's there. If I get rid of the generics on CommonBaseClass, and it's inherited classes, I can get the exports from my container as thus:
var container = new CompositionContainer(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
var exports = container.GetExportedValues<CommonBaseClass>();
What I want to do, is to get the generics version of exports:
var exports = container.GetExportedValues<CommonBaseClass<ICommonInterface>>();
There aren't any errors, just no results.