Question: I have read a bit about constraints and am trying to implement it in my repository pattern.

I want something like the below but can't quite get it to compile.

```
 public interface IRepository<T>
 {
    void GetAllData<T>();
 }

 //This needs to inherit from IRepository
 //T has to be a model class
 //V has to be a class that implements IEmployeeRepo
 public interface IEmployeeRepo<T, V> where V : EmployeeRepo where T : class : IRepository<T>
 {
    void DoSomethingEmployeeRelated();
 }

 //Dont think this inheritance is correct
 public class EmployeeRepo<Employee, this> : IEmployeeRepo
 {

 }

 //My example model class
 public class Employee
 {
     public string Name {get;set;}
 }

```

Answer: 
In this situation i usually have a base repo class that implements IRepository<>, and is typed to a base Model class.

```
public interface IRepository<T> where T : IModel
 {
    void GetAll<T>();
    void GetById<T>(int id);
 }    

 public interface IEmployeeRepo<T> : IRepository<T> where T : IModel
 {
    void DoSomethingEmployeeRelated();
 }

 public class BaseRepo : IRepository<T> where T : IModel
 {

    public void GetAll<T>()
    {

    }

    public void GetById<T>(int id)
    {

    }
 }

 public class EmployeeRepo : BaseRepo<Employee>,  IEmployeeRepo<Employee>
 {
    public void DoSomethingEmployeeRelated()
    {

    }

 }

 //My example model class
 public class Employee : IModel
 {
     public int Id {get;set;}
     public string Name {get;set;}
 }

```
Try this;

```
public interface IRepository<T>
 {
    void GetAllData<T>();
 }

 //This needs to inherit from IRepository
 //T has to be a model class
 //V has to be a class that implements IEmployeeRepo
 public interface IEmployeeRepo<T, V> : IRepository<T> where V : EmployeeRepo where T : class
 {
    void DoSomethingEmployeeRelated();
 }

 //Dont think this inheritance is correct
 public class EmployeeRepo : IEmployeeRepo<Employee, EmployeeRepo>
 {
    public void DoSomethingEmployeeRelated()
    {

    }

    public void GetAllData<Employee>()
    {

    }
 }

 //My example model class
 public class Employee
 {
     public string Name {get;set;}
 }

```