Book Image

WCF Multi-layer Services Development with Entity Framework - Fourth Edition

By : Mike Liu
Book Image

WCF Multi-layer Services Development with Entity Framework - Fourth Edition

By: Mike Liu

Overview of this book

Table of Contents (20 chapters)
WCF Multi-layer Services Development with Entity Framework Fourth Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Hosting the HelloWorld WCF Service
Index

Chapter 6. Adding Database Support and Exception Handling

In the previous chapter, we created a WCF service with two layers. We didn't add the third layer, that is, the data access layer. Therefore, all of the service operations just returned a fake result from the business logic layer.

In this chapter, we will add the third layer to the WCF service. We will also introduce fault contracts for service error handling.

We will accomplish the following tasks in this chapter:

  • Creating the data access layer project

  • Calling the data access layer from the business logic layer

  • Preparing the Northwind database for the service

  • Adding the connection string to the configuration file

  • Querying the database using GetProduct

  • Testing the GetProduct method

  • Updating the database using UpdateProduct

  • Testing the UpdateProduct method

  • Adding a fault contract to the service

  • Throwing a fault contract exception to the client

  • Updating the client program to catch the fault exception

  • Changing exception options

  • Testing the service fault...