WHAT'S IN THIS CHAPTER?
The role of services and the service layer in an enterprise ASP.NET application
Service oriented architecture and why it's needed
The use of the Facade pattern
Messaging patterns such as document message, request-response, reservation, and idempotent
An exercise that utilizes WCF for SOA in addition to well-known messaging patterns
Chapter 4 dealt with the organization of your business middleware, but how do you expose the business logic to your applications in an easy-to-use and consistent manner that maps to your business needs? The answer lies in the service layer.
Sitting between your presentation and business layer, the service layer provides an interface that defines the application's boundaries and the operations available to the client. Behind the façade that the service layer portrays to the client is the encapsulation of business logic, validation, and workflow and the coordination of persistence and retrieval of business entities.
The role of the service layer is similar to that of the Transaction Script pattern that was introduced in Chapter 4 in that it typically maps to business use cases. Unlike the Transaction pattern, however, the service layer simply coordinates the business use case transaction and delegates work to the business objects for all the lower-level implementation details. The service layer encapsulates the business model and acts as an interface into the application for all parties, ...