After reading this , I still have a question :
I use this code to query the db :
c# :
new BLL().GetPersonById(1)
BLL :
public Person GetPersonById(int id)
{
return new DAL ().GetPersonById(1);
}
DAL :
public Person GetPersonById(int id)
{
// goto db and create instance of Person and fill its data...
}
However , am I doing it wrong ,
Should my DAL return DataTable
instead ? ( so the BLL will create Person .... ?)
DAL :
public DataTable GetPersonById(int id)
{
// goto db ...
}
Thank you.
Edit :
the Person object is defined in BE dll ( business entity).
Your DAL, well the Repository to be exact, returns Person which is a business object defined in BLL.
BLL shouldn't depend on the DAL, at most it defines some interfaces which will be implemented in the DAL. However, the app asks the DAL for stored business objects as is its responsiblity to deal with everything persistence.
And yes, the DAL depends on the BLL. THe DAL sohld return only aplication objects (business objects or view models), everything persistence access related should be hidden.