Design Patterns Architecture – Data Access Layer, Business Class or Repository

Architecturedesign-patterns

I've been having a debate within my team on what constitutes a Data Access Layer vs Data Functions vs Business Layers.

My thoughts is all database access is done in a data access layer with Repository classes. The DAL contains utility classes & methods that populate a DataSet, List<>, POCO, Execute SQL, but as internal classes using your choice of Access method: ADO, EntityFramework, nHibernate, etc.
The Business layer then interacts with the DAL without knowing any of SQL or data access methodology.

A teammate has this approach. The stored procedure names and SQL are in the business classes. Then they are passed to the DAL which then populates and executes the SQL.

Which is the best practice?

Best Answer

There's no use for a BAL if all it is going to do is feed database access strings. You may also find that there is too much business logic contained in the stored procedures.

If you want data access in you business logic, call it something else.