This project has moved. For the latest updates, please go here.

Can't import Generic Types After Update from MEF 1 under .NET 4 to latest in .NET 4.5

Mar 27, 2014 at 1:11 AM

I have a project that was on .NET 4.0 using a MEF pre-release from about 2 years ago and we're trying to update it to .NET 4.5. The pre-release we were on doesn't work with .net 4.5, so we're attempting to update MEF to the latest, however it's failing while loading a generic interface type, that used to work:

    public IRepository<HealthCareDomain, LookupListCategory> Categories { get; set; }
Here's the class definition that it should be loading:

[Export( typeof( IRepository<,> ) )]
[PartMetadata( ExportScope.Key, TransactionScope.Id )]
[PartCreationPolicy( CreationPolicy.Shared )]
public class Repository<TDomain,TEntity> : IRepository<TDomain,TEntity>, IRepository
    where TEntity : class

How can I work around this?