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).
"Should my DAL return DataTable instead ? ( so the BLL will create Person .... ?)"
Not at all. Ideally DAL is supposed to deal with database and should return entity/application objects to BAL. DAL works as a abstraction for database to BLL.
And I am agree with MikeSW as he said "BLL shouldn't depend on the DAL, at most it defines some interfaces which will be implemented in the DAL."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With