I am designing a WCF service that has several functions:
1. ProductDTO GetProduct ( Guid productId )
2. void SetProduct ( ProductDTO product )
3. List<ProductDTO> GetAllProducts()
4. void SetAllProductValues ( int newValue )
These are the operations the Service will support. I will have a Business Layer (BL) and a Data-Access Layer (DAL).
I will be using LINQ-TO-EF as my ORM to connect to the SQL server tables.
My question is - what exactly should the DAL contain ?
I am asking this question because I have read 2 different books saying different things:
First Approach: the DAL contains only classes needed for data-access layer (if at all). It includes special entities or functions for that. The EDMX and model file for the LINQ-TO-EF is in a seperate assembly (that is referenced by the BL and the Service Layer). In this method - the BL contains the actual functions that perform the LINQ queries. For example : 'GetProduct' will perform the LINQ query to extract data from the DB. So - in this approach - what exactly is supposed to be in the DAL ? Is it empty ?
Second Approach: the DAL contains functions for performing CRUD operations on the DB, meaning - any LINQ-TO-EF queries will be done in the DAL. So - in this approach - what exactly does the BL do except for maybe some validations ?
Which approach is the correct one and how does that answer my concern of that approach ?