Free Sample
+ Collection

WCF 4.5 Multi-Layer Services Development with Entity Framework

Mike Liu

If you’re looking for a practical, user-friendly guide to WCF and Entity Framework, here it is – a step-by-step tutorial that focuses on the essentials of building SOA applications on Microsoft to get you started straight away.
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849687669
Paperback394 pages

About This Book

  • This book will teach you WCF, Entity Framework, LINQ, and LINQ to Entities quickly and easily.
  • Apply best practices to your WCF services and utilize Entity Framework in your WCF services.
  • Practical, with step-by-step instructions and precise screenshots, this is a truly hands-on book for all C++, C#, and VB.NET developers.

Who This Book Is For

This book is for C#, VB.NET, and C++ developers who are eager to get started with WCF and Entity Framework, and want a book that is practical and rich with examples from the very beginning.

Developers and architects evaluating SOA implementation technologies for their company will find this book particularly useful because it gets you started with Microsoft's tools for SOA and shows you how to customize our examples for your prototypes.

This book presumes basic knowledge of C# or C++. Previous experience with Visual Studio will be helpful but is not required, as detailed instructions are given throughout the book.

Table of Contents

Chapter 1: Web Services and Windows Communication Foundation
What is SOA?
Web services
Web services: standards and specifications
Windows Communication Foundation (WCF)
WCF production and development environments
Chapter 2: Implementing a Basic HelloWorld WCF Service
Creating the HelloWorld solution and project
Creating the HelloWorldService service contract interface
Implementing the HelloWorldService service contract
Hosting the WCF service in IIS Express
Creating a client to consume the WCF service
Chapter 3: Hosting and Debugging the HelloWorld WCF Service
Hosting the HelloWorld WCF service
Debugging the HelloWorld WCF service
Chapter 4: Implementing a WCF Service in the Real World
Why layer a service?
Creating a new solution and project using WCF templates
Creating the service interface layer
Adding a business logic layer
Chapter 5: Adding Database Support and Exception Handling
Adding a data access layer
Adding error handling to the service
Chapter 6: LINQ: Language Integrated Query
What is LINQ?
Creating the test solution and project
Datatype var
Automatic properties
Object initializer
Collection initializer
Anonymous types
Extension methods
Lambda expressions
Built-in LINQ extension methods and method syntax
LINQ query syntax and query expression
Built-in LINQ operators
Chapter 7: LINQ to Entities: Basic Concepts and Features
ORM: Object-Relational Mapping
Entity Framework
LINQ to Entities
Comparing LINQ to Entities with LINQ to Objects
Comparing LINQ to SQL with LINQ to Entities
Creating a LINQ to Entities test application
Creating the data model
Querying and updating a database table
Viewing generated SQL statements
Deferred execution
Deferred (lazy) loading versus eager loading
Joining two tables
Querying a view
Chapter 8: LINQ to Entities: Advanced Concepts and Features
Calling a stored procedure
Handling simultaneous (concurrent) updates
Transaction support
Chapter 9: Applying LINQ to Entities to a WCF Service
Creating the LINQNorthwind solution
Modeling the Northwind database
Creating the business domain object project
Using LINQ to Entities in the data access layer
Creating the business logic layer
Creating the service interface layer
Testing the service with the WCF Test Client
Testing concurrency with our own client
Chapter 10: Distributed Transaction Support of WCF
Creating the DistNorthwind solution
Hosting the WCF service in IIS
Testing the transaction behavior of the WCF service
Enabling distributed transaction support
Understanding the distributed transaction support of a WCF service
Testing the distributed transaction support of the WCF service
Tradeoffs of distributed transactions
Chapter 11: WCF Security
WCF security components
Hosting a WCF service using Basic Authentication
Hosting a WCF service with Windows Authentication
WCF Security Guidance
Chapter 12: Extending WCF Services
WCF runtime architecture
Why extend WCF services?
WCF extension points
Extending a WCF service
Extending HelloWorldService

What You Will Learn

  • Create a WCF service without using the built-in WCF templates so you can understand what’s going on under the hood. Host a WCF service in IIS Express, ASP.NET Development Server, managed applications, IIS, and Windows Service.
  • Explore and learn different debugging options for a WCF service.
  • Build a multi-layer real-world WCF service from scratch to understand every layer of a WCF service and apply it to your real work.
  • Learn basic and advanced concepts and features of Entity Framework, LINQ, and LINQ to Entities.
  • Apply LINQ to Entities to the data access layer of a WCF service with Self Tracking Entities.
  • Control concurrent updates to the database with WCF and LINQ to Entities.
  • Add distributed transaction support to a WCF service.
  • Understand various security settings of WCF, and host a WCF service with Basic Authentication, SSL, and Windows Authentication.
  • Explore extension points of WCF and extend a WCF service with custom behaviors.


In Detail

WCF is Microsoft's recommended model for building services and Entity Framework is Microsoft’s preferred ORM for accessing underlying data storages. Learning WCF and Entity Framework has become essential and critical for every software developer to survive in this SOA world.

WCF and Entity Framework are two powerful yet complex technologies, and there are huge reference tomes out there in the market for these two technologies. With this book, you won’t get overwhelmed or scared away by tons of references; instead, you will be given a simple, easy-to-follow approach to get started. For the code solutions within this book, unlike many other WCF and EF books, where you have just one code snippet after another code snippet, all solutions in this book are fully working and completely finished. These solutions are independent of each other, yet built on top of each other, and get more and more sophisticated as the book progresses, so you can learn more advanced WCF and EF techniques easily and quickly.

This book is a step-by-step tutorial to guide you through learning WCF, Entity Framework, LINQ, and LINQ to Entities. You will be guided to create six WCF and Entity Framework solutions from scratch, of which three are multi-layered real-world WCF service solutions, so you will not only be reading, but also be coding through the book, to gain practical experience of WCF and Entity Framework.

Various test clients will be associated with each solution and all solutions can be built and run independently of other solutions. Clear instructions and relevant screenshots will make sure you won't get lost in the world of WCF and Entity Framework. Configuration files, host applications, test clients, and WCF services for each solution will also be available for download for you to examine, modify, and debug from the outside in.

The book focuses on the essentials of using WCF and Entity Framework, rather than providing a reference to every single possibility. It leaves the reference material online where it belongs, and concentrates instead on practical examples, code, and advice.


Read More