Proper implementation of generic repository What can be done better in this code?  I am sure it's not missing much.

You can copy and paste the whole thing in LinqPad; it's all there.

public interface IRep&lt;T&gt;
{
    List&lt;T&gt; GetAll();
}

public interface IEntity
{
    int Id{get;set;}
}

public class Customer: IEntity
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int Age { get; set; }
}

public class Product: IEntity
{
    public int Id { get; set; }
    public string Code { get; set; }
    public decimal Price {get;set;}
}

public class RepProduct: IRep&lt;Product&gt;
{
    public List&lt;Product&gt; GetAll()
    {
        List&lt;Product&gt; list = new List&lt;Product&gt;();
        list.Add(new Product() {Id=1, Code = "burger", Price = 2.99M});
        list.Add(new Product() {Id=1, Code = "fries", Price = 1.99M});
        list.Add(new Product() {Id=1, Code = "pepsi", Price = 1.99M});
        return list;
    }
}

public class RepCustomer: IRep&lt;Customer&gt;
{
    public List&lt;Customer&gt; GetAll()
    {
        List&lt;Customer&gt; list = new List&lt;Customer&gt;();
        list.Add(new Customer() {Id=1,Name="Fred", Age=44   });
        list.Add(new Customer() {Id=2,Name="Victoria", Age=13   });
        list.Add(new Customer() {Id=3,Name="Kiefer", Age=10 });
        return list;}
}

void Main()
{

    IRep&lt;IEntity&gt; rep = null;



}
To get it to work, use IEnumerable&lt;T&gt; instead of List&lt;T&gt; as it's covariant:

public interface IRep&lt;out T&gt;
{
    IEnumerable&lt;T&gt; GetAll();
}

public interface IEntity
{
    int Id { get; set; }
}

public class Customer: IEntity
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int Age { get; set; }
}

public class Product: IEntity
{
    public int Id { get; set; }
    public string Code { get; set; }
    public decimal Price {get;set;}
}

public class RepProduct: IRep&lt;Product&gt;
{
    public IEnumerable&lt;Product&gt; GetAll()
    {
        List&lt;Product&gt; list = new List&lt;Product&gt;();
        list.Add(new Product() {Id=1, Code = "burger", Price = 2.99M});
        list.Add(new Product() {Id=1, Code = "fries", Price = 1.99M});
        list.Add(new Product() {Id=1, Code = "pepsi", Price = 1.99M});
        return list;
    }
}

public class RepCustomer: IRep&lt;Customer&gt;
{
    public IEnumerable&lt;Customer&gt; GetAll()
    {
        List&lt;Customer&gt; list = new List&lt;Customer&gt;();
        list.Add(new Customer() {Id=1,Name="Fred", Age=44   });
        list.Add(new Customer() {Id=2,Name="Victoria", Age=13   });
        list.Add(new Customer() {Id=3,Name="Kiefer", Age=10 });
        return list;
    }
}

void Main()
{
    IRep&lt;IEntity&gt; rep = null;

    rep = new RepCustomer();
    Console.WriteLine(rep.GetAll());

    rep = new RepProduct();
    Console.WriteLine(rep.GetAll());
}