Click here to Skip to main content
15,886,004 members
Articles / Programming Languages / C#

Book Review: WCF 4.0 multi-tier services development with LINQ-to-Entities

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
3 Sep 2010CPOL4 min read 26.5K   7   8
A review of "WCF 4.0 multi-tier services development with LINQ-to-Entities"

This article is in the Book Review chapter. Reviews are intended to provide you with information on books - both paid and free - that others consider useful and of value to developers. Read a good programming book? Write a review!

Introduction

WCF 4.0 multi-tier services development with LINQ-to-Entities is about about using LINQ with Entity Framework to create a data layer in a WCF Web Service. The book approaches the content from the point of view of a junior developer--one that is not necessarily familiar with Visual Studio. The book generally approaches the topic from a useful lowest-level to highest-level evolution--starting with how to create a WCF Service from scratch and working up to creating a WCF Service with the built-in Visual Studio templates. The book follows the important contract-first design model for Web Services.

I like the book's approach to layering, it's a refreshing change to see purposeful decoupling of layers, and not something that simply pushes entity classes from the data layer all the way to the interface layer--each layer has its own concept of the domain entity in use. This is very important with Web Services because what can be implemented in a Web Service is a subset of what can be implemented in .NET; and to a certain extent, what can be modeled in the database and the data access layer is also a subset of what can be implemented in .NET. So, it's important that the business logic layer be free to implement the domain entities how it needs to, without being limited to what cannot be implemented in a Web Service message or in what cannot be implemented in a particular database. That is, in the examples, the entities created by the Entity Framework are restricted to the Data Access Layer, and they are not used in the Web Service's requests and responses.

The book generally shows a consistent example that evolves from single layer to multi-layer, starting with the service layer. This form of description is useful for people who are not familiar with layering. This also has a similar flow to Test-Driven Design (TDD).

This book covers, in detail, the use of much of the new C# 4 syntax, including LINQ (really LINQ syntax, plus anything that LINQ depends on in the new C# syntax; which is most of it). Two chapters are devoted to this new C# syntax. This book also covers in detail how to create WCF services with and without the built-in Visual Studio templates. For advanced developers, much of this book might be a bit beneath them--if you're already familiar with Visual Studio, layering, C# 4, and debugging in Visual Studio, you may find half the book details information you already know. If you are already familiar with WCF and Entity Framework, you probably won't get much out of this book--as expected.

There are a few points that I find are slightly off in terms of correctness; but none that apply to LINQ to Entities or WCF. Unfortunately, "multi-tier" really isn't detailed. The examples are strictly multi-layer, not multi-tier (assuming the client to the Web Service must always be considered its own tier--i.e., I infer more than two tiers from "multi-tier services"). The implementation of the Web Service (the interface layer, the business logic layer, and the data access layer) is a single tier in every example. The concepts of the book could easily be expanded to the business logic layer and the data access layer to wrap them in a WCF Web Service to truly implement a multi-tier service. There are several examples of performing automated tests (coded tests) within the book. I was a little disappointed that these weren't approached as unit tests and either implemented with the Visual Studio testing framework or another common unit testing framework like NUnit.

The book uses a few well-known patterns in its implementations; but, doesn't go into too much detail other than their implementation. For example, it uses the Data Access Object (DAO) pattern but doesn't use the term "Data Access Object". This isn't unexpected, since the book isn't about patterns. If you're the target audience of this book, I would suggest following up with some reading on patterns. The book generally implements the patterns it uses correctly, but I find the choice of some of the patterns to be somewhat academic. For example, the author chooses the typical Microsoft 3-layer architecture: interface layer (service layer), business logic layer, and data access layer. The typical problems of mixing business logic within the business logic entities and outside these entities occurs. I'll leave it as an exercise for the reader to research how to approach this problem (hint, check out my blog archive and keep reading my blog).

The book also doesn't really go into much detail about WCF configuration even with regard to Web Services. There's no detail of switching bindings like from HTTP to HTTPS, to TCP, etc. And there's no mention of SvcConfigEditor--an essential tool in the arsenal of every WCF developer.

If it wasn't obvious, I'd recommend this book to junior developers who need to get up to speed and be productive in WCF and Entity Framework in a short amount of time.

A sample chapter can be found at https://www.packtpub.com/sites/default/files/1148-chapter-4-implementing-a-wcf-service.pdf, and the publisher's landing page for the book can be found here: https://www.packtpub.com/wcf-4-0-multi-tier-services-development-with-linq-to-entities/book.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Peter Ritchie Inc. Software Consulting Co.
Canada Canada
Peter owns an operates Peter Ritchie Inc. Software Consulting Co., specializing in Windows software development.

A software expert with over 15 years experience, Peter's expertise lies in C++- and C#-based Windows applications utilizing .NET COM, ATL, WTL, MFC, ASP, SQL Server, etc.

Comments and Discussions

 
GeneralMy vote of 4 Pin
Richard MacCutchan20-Aug-10 7:15
mveRichard MacCutchan20-Aug-10 7:15 
General[My vote of 2] Not an article Pin
Richard MacCutchan20-Aug-10 4:19
mveRichard MacCutchan20-Aug-10 4:19 
GeneralRe: [My vote of 2] Not an article Pin
Peter Ritchie20-Aug-10 4:32
Peter Ritchie20-Aug-10 4:32 
GeneralRe: [My vote of 2] Not an article Pin
Richard MacCutchan20-Aug-10 6:22
mveRichard MacCutchan20-Aug-10 6:22 
GeneralRe: [My vote of 2] Not an article Pin
Peter Ritchie20-Aug-10 6:57
Peter Ritchie20-Aug-10 6:57 
GeneralRe: [My vote of 2] Not an article Pin
Richard MacCutchan20-Aug-10 7:15
mveRichard MacCutchan20-Aug-10 7:15 
GeneralRe: [My vote of 2] Not an article Pin
Peter Ritchie20-Aug-10 7:32
Peter Ritchie20-Aug-10 7:32 
GeneralRe: [My vote of 2] Not an article Pin
Nish Nishant20-Aug-10 10:20
sitebuilderNish Nishant20-Aug-10 10:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.