Until now, the WCF service contained only one layer. In this section, we will add a business logic layer and define some business rules in this layer.
Before we add the business logic layer, we need to add a project for the business domain objects. The business domain object project will hold definitions such as products, customers, and orders. These domain objects 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 that we defined in the previous section but will not be seen outside the service. The product business domain object will have the same properties as the product's contract data, plus some extra properties such as UnitsInStock
and ReorderLevel
. These properties will be used internally and shared by all the layers of the service. For example, when an order is placed, UnitsInStock
should be updated as well. Also, if the updated...