Reputation: 739
Am working on a .net 2.0 windows application. The data access layer[DAL] executes stored procs and returns datareader/dataset to the business layer[BL].
The BL which refers to DAL dll, iterates through the datareader/dataset, reads columns values, creates business objects and returns it to the UI layer.
Given this, is it ok here that the business layer is referring to columns of a database table?
Is this a good practice wrt layer design?
If I return Business object from the DAL instead of dataset/datareader, then my DAL project will have to refer to BL dll too.So,wont there be a circular reference here? Thanks.
Upvotes: 0
Views: 2113
Reputation: 498904
It is not good practice, as your data layer is exposing implementation details and thus information hiding and encapsulation are lost.
You should be passing objects that model your data.
For example, instead of an order
data row, you should be passing an Order
object.
Upvotes: 3