We have two layers in our solution. We need to add one more layer—the data access layer. We need to query a real database to get the product information and update the database for a given product.
First we will create the project for the data access layer. As we did for the business logic layer, what we need to do is add a C# class library project named RealNorthwindDAL
, where
DAL stands for Data Access Layer, to the solution. Then rename the Class1.cs
to ProductDAO.cs
and modify it as follows:
Change its namespace from
RealNorthwindDAL
toMyWCFServices.
RealNorthwindDAL
.Change the class name from
Class1
toProductDAO
.Add a reference to the project,
RealNorthwindEntities
.
Now let's modify ProductDAO.cs
for our product service: