Now that we have the data access layer ready, we can modify the business logic layer to call this layer.
ProductLogic.cs
. ProductLogic
class to be a public
class. productDAL
variable as a class member, like this:ProductDAL productDAL = new ProductDAL();
GetProduct
method as follows:public ProductEntity GetProduct(int id) { return productDAL.GetProduct(id); } Add UpdateProduct method like this: public bool UpdateProduct(ProductEntity productEntity) { return productDAL.UpdateProduct(productEntity); }
This class is very similar to the business logic class in the previous chapters, except that in the previous chapters this project references the BusinessEntities
project, whereas here it only references the data access project. As we said earlier, this is because the product entity is now embedded inside the data access project LINQ to SQL designer class file, instead of being in a separate BusinessEntities
project.