dimanche 22 mars 2015

For a concrete SQL Repository, should I encapsulate the SQL logic inside or outside the repository methods?


If I have a concrete repository based on SQL data access, should I pass in SQL to the repository methods or encapsulate them within the methods. I feel if I pass them in, then I am coupling my repository with SQL data access, so I am leaning toward putting the SQL in the methods? Here are my two options:



public GetPeople(string sql)
{
//Query people with passed in sql
}

public GetPeople()
{
//Query people with sql logic here, possibly conditional logic
}




Aucun commentaire:

Enregistrer un commentaire