MEF в .NET Framework 4.5 поддерживает экспорт универсальных типов, он работает по атрибутам:
[InheritedExport(typeof(Interface1<>))]
public interface Interface1<T>
{
}
public class Type1 : Interface1<string>
{
}
Объект экспорта может быть разрешен:
AssemblyCatalog cat = new AssemblyCatalog(typeof(Program).Assembly, builder);
CompositionContainer container = new CompositionContainer(cat);
var o = container.GetExportedValue<Interface1<string>>();
Но почему это не работает, используйте базовый API соглашения:
RegistrationBuilder builder = new RegistrationBuilder();
builder.ForType<Type1>().Export(it => it.AsContractType(typeof(Interface1<>)).Inherited());
Спасибо!