lundi 23 mars 2015

What is better repository design?


I have tables that I insert, delete and update, but I read from views. At times, I may read from the tables as well. What is a better generic interface for a Repository:



public interface IViewRepository<T>
{
//Read queries
}

public interface ITableRepository<T>
{
//Insert, Update, Delete queries
}


or just one repository to handle both tables and views



public interface IRepository<TTable,TView>
{
//CRUD
}


Is it better to have something like IPersonRepository and ICarRepository and then in the interfaces, make the methods generic such as T GetPerson<T> and T GetCar<T>?





Aucun commentaire:

Enregistrer un commentaire