Q:

How to set a constraint for a type so it must be of another generic typed type

This is probably asked before but I can't work it out. Maybe if I could get the title right I could goolge it.
I have got this generic repository interface:
public interface IRepository<TEntity>
{
    TEntity Resolve<TEntity>(); // dummy function, just to get the idea
}

I also have a generic unit of work, which is able to resolve a generic repository:
public interface IUnitOfWork
{
    IRepository<TEntity> GetGenericRepository<TEntity>() where TEntity : class;
}

So far so good. 
But as real life continues, I would like to create a custom repository, with some specific funtions. So I was thinking: inheritance; like this:
public class SpecialRepository : IRepository<SomeEntityType>
{
    public void SomeSpecialFunction() { };
}

Obviously, this type cannot be resolved with the GetGenericRepository methode so I thought: lets add a extra method to the IUnitOfWork interface:
public interface IUnitOfWork
{
    //same old get generic repository
    IRepository<TEntity> GetGenericRepository<TEntity>() where TEntity : class;

    //the newly added.
    T GetInheretedRepository<T>() where T : class;
}

I want to be able to call the unit of work with the special repository, something like this:
public test()
{
    IUnitOfWork uow = new UnitOfWork();

    //I want to make this call with a constraint on TemplateRepo
    //to enforce it's type: IRepository<T> (which TemplateRepo is)
    var y = uow.GetInheretedRepository<TemplateRepo>(); 
}

The question is: how can I restrict type T in T GetInheretedRepository<T>() where T : class; to be of type: IRepository<TEntity>?
I tried this:
public interface IUnitOfWork
{  
    //the newly added.
    //error: Only class or interface could be specified as constraint
    T GetInheretedRepository<T>() where T : class, IRepository;     }

and
public interface IUnitOfWork
{  
    //the newly added.
    //error: type argument missing
    T GetInheretedRepository<T>() where T : class, IRepository<>; 
}

that doesnt work.
I could drop the constrain as a quick-fix or perhaps create an inherited unit of work, but then; the question still remains.

A:

You need to specify second Type like 
public interface IUnitOfWork
{  
    //the newly added.
    T GetInheretedRepository<T, TEntity>() where T : class, IRepository<TEntity>; 
}

public interface IRepository<TEntity>
{
    TEntity Resolve(); // dummy function, just to get the idea
}

example that compiles fine - https://dotnetfiddle.net/MmmPil

