Note : this is not a duplicate !
I have the following Example :
public interface IRepository<TEntity> where TEntity : IEntity
{
...
}
public class Repository<TEntity> : IRepository<TEntity> where TEntity : IEntity
{
...
}
public class Repository<SpecialClass> : IRepository<SpecialClass>
{
...
}
public class SpecialClass: IEntity
{
...
}
Now I want to use Repository<> class for every IRepository<> except for IRepository<SpecialClass> :
// every IRepository<> :
services.AddScoped(typeof(IRepository<>), typeof(RepositoryEFCore<>));
// but not for SpecialClass
services.AddScoped(typeof(IRepository<SpecialClass>), typeof(Repository<SpecialClass>));
The question is how do I register two(or multiple) different classes for the same interface while the interface has already been registered for another class ?