Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
WCF 4.0 Multi-tier Services Development with LINQ to Entities

You're reading from   WCF 4.0 Multi-tier Services Development with LINQ to Entities Build SOA applications on the Microsoft platform with this hands-on guide updated for VS2010

Arrow left icon
Product type Paperback
Published in Jun 2010
Publisher Packt
ISBN-13 9781849681148
Length 348 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Mike Liu Mike Liu
Author Profile Icon Mike Liu
Mike Liu
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

WCF 4.0 Multi-tier Services Development with LINQ to Entities
Credits
About the Author
About the Reviewers
Preface
1. Introducing Web Services and Windows Communication Foundation FREE CHAPTER 2. Implementing a Basic HelloWorld WCF Service 3. Hosting and Debugging the HelloWorld WCF Service 4. Implementing a WCF Service in the Real World 5. Adding Database Support and Exception Handling to the RealNorthwind WCF Service 6. LINQ—Language Integrated Query 7. LINQ to Entities: Basic Concepts and Features 8. LINQ to Entities: Advanced Concepts and Features 9. Applying LINQ to Entities to a WCF Service 10. Distributed Transaction Support of WCF Index

Adding a data access layer


We have two layers in our solution. We need to add one more layer—the data access layer. We need to query a real database to get the product information and update the database for a given product.

Creating the data access layer project

First we will create the project for the data access layer. As we did for the business logic layer, what we need to do is add a C# class library project named RealNorthwindDAL, where DAL stands for Data Access Layer, to the solution. Then rename the Class1.cs to ProductDAO.cs and modify it as follows:

  • Change its namespace from RealNorthwindDAL to MyWCFServices. RealNorthwindDAL.

  • Change the class name from Class1 to ProductDAO.

  • Add a reference to the project, RealNorthwindEntities.

Now let's modify ProductDAO.cs for our product service:

  • Add the following using statement:

    	using MyWCFServices.RealNorthwindEntities;
  • Add two new methods to the ProductDAO class. The first method is GetProduct, which should be as follows:

    	public ProductEntity...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime