Adding a business logic layer
Until now the web service has contained only one layer. In this section, we will add a business logic layer and define some business rules in this layer.
Adding the product entity project
Before we add the business logic layer, we need to add a project for business entities. The business entities project will hold all business entity object definitions such as products, customers, and orders. These entities will be used across the business logic layer, the data access layer, and the service layer. They will be very similar to the data contracts we defined in the previous section, but will not be seen outside of the service. The Product entity will have the same properties as the product contract data, plus some extra properties such as UnitsInStock
and ReorderLevel
. These properties will be used internally and shared by all layers of the service. For example, when an order is placed, UnitsInStock
should be updated as well. Also, if the updated UnitsInStock
is...