I am trying to use MEF to Export the following:
[Export(typeof(IRepository<>))]
public class Repository<T> : IRepository<T>
where T : class
{
With an import of
[Import(typeof(IRepository<>))]
private IRepository<Contact> repository;
But I keep getting an error message when composing MEF of:
=========================================
The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) No valid exports were found that match the constraint '((exportDefinition.ContractName = "Interfaces.IRepository()") && (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") && "Interfaces.IRepository()".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.
Resulting in: Cannot set import 'SoCLINQ2SQL.RepositoryTest.repository (ContractName="Interfaces.IRepository()")' on part 'SoCLINQ2SQL.RepositoryTest'. Element: SoCLINQ2SQL.RepositoryTest.repository (ContractName="Interfaces.IRepository()") --> SoCLINQ2SQL.RepositoryTest