WCF Multi-tier Services Development with LINQ


WCF Multi-tier Services Development with LINQ
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$20.24
save 25%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • Master WCF and LINQ concepts by completing practical examples and apply them to your real-world assignments
  • First book to combine WCF and LINQ in a multi-tier real-world WCF service
  • Ideal for beginners who want to build scalable, powerful, easy-to-maintain WCF services
  • Rich with example code, clear explanations, interesting examples, and practical advice – a truly hands-on book for C++ and C# developers

Book Details

Language : English
Paperback : 384 pages [ 235mm x 191mm ]
Release Date : December 2008
ISBN : 1847196624
ISBN 13 : 9781847196620
Author(s) : Mike Liu
Topics and Technologies : All Books, Application Development, Microsoft Development , Enterprise, Microsoft


Table of Contents

Preface
Chapter 1: SOA—Service Oriented Architecture
Chapter 2: WCF – Windows Communication Foundation
Chapter 3: Implementing a Basic HelloWorld WCF Service
Chapter 4: Hosting and Debugging the HelloWorld WCF Service
Chapter 5: Implementing a WCF Service in the Real World
Chapter 6: Adding Database Support and Exception Handling to the RealNorthwind WCF Service
Chapter 7: Modeling a WCF Service with Service Factory
Chapter 8: Implementing the WCF Service with Service Factory
Chapter 9: Introducing Language-Integrated Query (LINQ)
Chapter 10: LINQ to SQL: Basic Concepts and Features
Chapter 11: LINQ to SQL: Advanced Concepts and Features
Chapter 12: Applying LINQ to SQL to a WCF Service
Chapter 13: Distributed Transaction Support of WCF
Index
  • Chapter 1: SOA—Service Oriented Architecture
    • What is SOA?
    • Why SOA?
    • How do we implement SOA?
    • SOA from different users' perspectives
    • Complexities in SOA implementation
    • Web services
      • What is a web service?
      • Web service WSDL
      • Web service proxy
      • SOAP
    • Web services: standards and specifications
      • WS-I Profiles
      • WS-Addressing
      • WS-Security
      • WS-ReliableMessaging
      • WS-Coordination and WS-Transaction
    • Summary
  • Chapter 2: WCF – Windows Communication Foundation
    • What is WCF?
    • Why is WCF used for SOA?
    • WCF architecture
    • Basic WCF concepts—WCF ABCs
      • Address
      • Binding
      • Contract
        • Service contract
        • Operation contract
        • Message contract
        • Data contract
        • Fault contract
      • Endpoint
      • Behavior
      • Hosting
        • Self hosting
        • Windows services hosting
        • IIS hosting
        • Windows Activation Services hosting
      • Channels
      • Metadata
    • WCF production and development environments
    • Summary
  • Chapter 3: 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 ASP.NET Development Server
      • Creating the host application
      • Testing the host application
      • ASP.NET Development Server
      • Adding an svc file to the host application
      • Adding a web.config file to the host application
      • Starting the host application
    • Creating a client to consume the WCF service
      • Creating the client application project
      • Generating the proxy and configuration files
      • Customizing the client application
      • Running the client application
      • Setting the service application to AutoStart
    • Summary
  • Chapter 4: Hosting and Debugging the HelloWorld WCF Service
    • Hosting the HelloWorld WCF service
      • Hosting the service in a managed application
        • Hosting the service in a console application
        • Consuming the service hosted in a console application
      • Hosting the service in a Windows service
      • Hosting the service in the Internet Information Server
        • Preparing the folders and files
        • Creating the virtual directory
        • Starting the WCF service in the IIS
        • Testing the WCF service hosted in the IIS
      • Advanced WCF service hosting options
    • Debugging the HelloWorld WCF service
      • Debugging from the client application
        • Starting the debugging process
        • Debugging on the client application
        • Enabling debugging of the WCF service
        • Stepping into the WCF service
      • Debugging only the WCF service
        • Starting the WCF Service in debugging mode
        • Starting the client application in non-debugging mode
        • Starting the WCF service and client applications in debugging mode
      • Attaching to a WCF service process
        • Running the WCF service and client applications in non-debugging mode
        • Debugging the WCF service hosted in IIS
      • Just-In-Time debugger
    • Summary
  • Chapter 5: Implementing a WCF Service in the Real World
    • Why layering a service?
    • Creating a new solution and project using WCF templates
      • Using the C# WCF service library template
      • Using the C# WCF service application template
    • Creating the service interface layer
      • Creating the service interfaces
      • Creating the data contracts
      • Implementing the service contracts
      • Modifying the app.config file
      • Testing the service using WCF Test Client
      • Testing the service using our own client
    • Adding a business logic layer
      • Adding the product entity project
      • Adding the business logic project
      • Calling the business logic layer from the service interface layer
      • Testing the WCF service with a business logic layer
    • Summary
  • Chapter 6: Adding Database Support and Exception Handling to the RealNorthwind WCF Service
    • Adding a data access layer
      • Creating the data access layer project
      • Calling the data access layer from the business logic layer
      • Preparing the database
      • Adding the connection string to the configuration file
      • Querying the database (GetProduct)
      • Testing the GetProduct method
      • Updating the database (UpdateProduct)
    • Adding error handling to the service
      • Adding a fault contract
      • Throwing a fault exception
      • Updating client program to catch the fault exception
      • Disabling the Just My Code debugging option
      • Testing the fault exception
    • Summary
  • Chapter 7: Modeling a WCF Service with Service Factory
    • What is the Service Factory?
    • What are Guidance Packages?
    • Preparing environments
      • Installing Guidance Automation packages
      • Installing Microsoft Service Software Factory
    • Differences between the December 2006 version and the February 2008 version
    • Modeling the data contracts
      • Creating the solution
      • Adding the data contract model
      • Adding the product data contract
      • Adding the product fault contract
    • Modeling the service contracts
      • Adding the ProductService contract model
      • Adding the GetProduct operation
      • Adding the message contracts
      • Adding the service contracts
      • Adding the connectors
    • Specifying the implementation technology for the models
      • Choosing the implementation technology for service contract model
      • Changing the property values for service contracts
      • Choosing the implementation technology for the data contract model
      • Changing the order property for data members
    • Generating source code
      • Creating the service projects
      • Linking contract models to projects
      • Validating the contract models
      • Generating the source code
    • Summary
  • Chapter 8: Implementing the WCF Service with Service Factory
    • Creating the business entities
    • Customizing the data access layer
      • Adding the connection strings
      • Adding a reference to the BusinessEntities project
      • Adding the data access class
    • Customizing the business logic
    • Translating the messages
    • Customizing the Fault contract
    • Customizing the product service
    • Modeling the host application and the test client
      • Modeling the host application
      • Generating the host application
      • Adding the test client to the host model
      • Generating the client proxy
    • Customizing the client
    • Testing the service
    • Summary
  • Chapter 9: Introducing Language-Integrated Query (LINQ)
    • What is LINQ
    • Creating the test solution and project
    • New data type 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
    • Summary
  • Chapter 10: LINQ to SQL: Basic Concepts and Features
    • ORM—Object-Relational Mapping
      • LINQ to SQL
    • Comparing LINQ to SQL with LINQ to Objects
    • LINQ to Entities
    • Comparing LINQ to SQL with LINQ to Entities
    • Creating LINQ to SQL test application
    • Modeling the Northwind database
      • Adding a LINQ to SQL item to the project
      • Connecting to the Northwind database
      • Adding tables and views to the design surface
      • Generated LINQ to SQL classes
    • Querying and updating the database with a table
      • Querying records
      • Updating records
      • Inserting records
      • Deleting records
      • Running the program
    • Deferred execution
      • Checking deferred execution with SQL profiler
      • Checking deferred execution with SQL logs
      • Deferred execution for singleton methods
      • Deferred execution for singleton methods within sequence expressions
    • Deferred (lazy) loading versus eager loading
      • Lazy loading by default
      • Eager loading with load options
      • Filtered loading with load options
      • Combining eager loading and filtered loading
    • Joining two tables
    • Querying a view
    • Summary
  • Chapter 11: LINQ to SQL: Advanced Concepts and Features
    • Calling a stored procedure
      • Calling a simple stored procedure
      • Mapping a stored procedure to an entity class
      • Handling output parameters, return codes, multiple shapes of a single result-set, and multiple result-sets
        • Creating a complex stored procedure
        • Modeling the stored procedure
        • Customizing DataContext class for the stored procedure
        • Testing the stored procedure
    • Compiled query
    • Direct SQL
    • Dynamic query
    • Inheritance
      • LINQ to SQL single-table inheritance
      • Modeling the BaseProduct and Beverage classes
      • Modeling the Seafood class
      • The generated classes with inheritance
      • Testing the inheritance
  • Handling simultaneous (concurrent) updates
    • Detecting conflicts using the Update Check property
      • Writing the test code
      • Testing the conflicts
    • Detecting conflicts using a version column
      • Adding a version column
      • Modeling the products table with a version column
      • Writing the test code
      • Testing the conflicts
  • Transactions support
    • Implicit transactions
    • Explicit transactions
    • Participating in existing ADO.NET transactions
  • Adding validations to entity classes
  • Debugging LINQ to SQL programs
  • Summary
  • Chapter 12: Applying LINQ to SQL to a WCF Service
    • Creating the LINQNorthwind solution
    • Modeling the data contracts
    • Modeling the service contracts
    • Generating the source code
    • Modeling the Northwind database
    • Implementing the data access layer
      • Adding GetProduct to the data access layer
      • Adding UpdateProduct to the data access layer
    • Implementing the business logic layer
    • Implementing the service interface layer
      • Modifying the ProductFault class
      • Modifying the DataContract class
      • Modifying the ServiceImplementation class
        • Adding references to the project
        • Adding a translator class
        • Implementing the GetProduct and UpdateProduct operations
    • Creating the host application and the test client
      • Modeling the host application and the test client
      • Implementing the GetProduct functionality
      • Implementing the UpdateProduct functionality
    • Testing the GetProduct and UpdateProduct operations
    • Testing concurrent update manually
    • Testing concurrent update automatically
    • Summary
  • Chapter 13: Distributed Transaction Support of WCF
    • Creating the DistNorthwind solution
    • Testing the transaction behaviour of the WCF service
      • Creating a client to call the WCF service sequentially
      • Testing the sequential calls to the WCF service
      • Wrapping the WCF service calls in one transaction scope
      • Testing multiple database support of the WCF service
        • Modifying the data access layer for the second database support
        • Modifying the business logic layer for the second database support
        • Modifying the service interface layer for the second database support
        • Modifying the service host for the second database support
        • Modifying the client for the second database support
        • Testing the WCF service with two databases
    • Enabling distributed transaction support
      • Enabling transaction flow in bindings
        • Enabling transaction flow on the service application
        • Enabling transaction flow on the client application
      • Modifying the service operation contract to allow a transaction flow
      • Modifying the service operation implementation to require a transaction scope
    • Understanding distributed transaction support of a WCF service
    • Testing the distributed transaction support of the WCF service
      • Propagating a transaction from client to the WCF service
      • Configuring the Distributed Transaction Coordinator
      • Configuring the firewall
    • Summary

Mike Liu

Mike Liu studied Mathematics and Software Engineering at Nanjing University and Brandeis University, graduated with a bachelor’s degree and a master's degree respectively. He is a Sun Certified Java Programmer (SCJP), Microsoft Certified Solution Developer for Visual Studio 6.0 and Microsoft Certified Solution Developer for .NET. He has been working as a software Engineer/architect on various platforms (DOS, Unix, and Windows) using C/C++, Java, VB/VB.NET, and C#. Mike started using C# for production development back in 2001 when C# was still in beta stage and he is now working as a senior software engineer for an investment management firm in Boston, Mass. Mike had his first book,MITT: Multi-user Integrated Table-processing Tool Under Unix,published in 1993, and a second book,Advanced C# Programming,published in 2003. The previous two versions of this book,WCF Multi-tier Services Development with LINQ and WCF 4.0 Multi-tier Services Development with LINQ to Entities,were published in 2008 and 2010.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

WCF Multi-tier Services Development with LINQ +    Oracle 11g Anti-hacker's Cookbook =
50% Off
the second eBook
Price for both: £26.35

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Create, host, and consume your first WCF service in just a few minutes
  • Explore and learn different hosting and debugging options for a WCF service
  • Build a multi-tier real-world WCF service from scratch to understand every layer of a WCF service and apply it to your real work
  • Add exception handling to your WCF services
  • Accelerate your WCF service development with Service Factory by applying best practices
  • Understand basic and advanced concepts and features of LINQ and LINQ to SQL
  • Communicate securely and reliably with databases by rewriting the data access layer of your WCF service with LINQ to SQL
  • Control concurrent updates to the databases and add distributed transaction support to your WCF services

In Detail

WCF is Microsoft's unified programming model for building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments. WCF is built on the Microsoft .NET Framework and simplifies development of connected systems. It unifies a broad array of distributed systems capabilities in a composable, extensible architecture that supports multiple transports, messaging patterns, encodings, network topologies, and hosting models. It is the next version of several existing products: ASP.NET's web methods (ASMX), Microsoft Web Services Enhancements for Microsoft .NET (WSE), .NET Remoting, Enterprise Services, and System.Messaging.

If you are a C++/C# developer looking for a book to build real-world WCF services, you would have run into the huge reference tomes currently in the market. These books are crammed with more information than you need and most build simple one-tier WCF services. And if you plan to use LINQ in the data access layer, you might buy another volume that is just as huge and just as expensive.

Our book is the quickest and easiest way to learn WCF and LINQ in Visual Studio 2008. It is the first book to combine WCF and LINQ in a multi-tier real-world WCF service. Multi-tier services provide separation of concerns and better factoring of code, which gives you better maintainability and the ability to split layers out into separate tiers for scalability. WCF and LINQ are both powerful yet complex technologies from Microsoft, but this book will get you through. The mastery of these two topics will quickly get you started creating service-oriented applications, and allow you to take your first steps into the world of Service Oriented Architecture without getting overwhelmed.

Through this book, you will first understand WCF concepts by developing a functional service and apply these techniques to a multi-tier real-world WCF service. You will learn how to use WCF to define the contracts in the service interface layer, Plain Old C# Objects (POCO) to implement business rules in the business logic layer, and LINQ to communicate with the databases in the data access layer. Microsoft pattern and practice Web Service Software Factory is used to create the framework for this WCF service. Concurrency control and distributed transaction support are discussed and tested at the end of the book. Clear step-by-step instructions and precise screenshots will make sure you will not get lost in the new world of WCF and LINQ.

Master WCF and LINQ in a multi-tier WCF service by completing practical examples and apply them to your real-world assignments

Approach

This book is a step-by-step tutorial with clear instructions and screenshots to guide you through the creation of a multi-tier real-world WCF service solution. Configuration files, host applications, test clients, and WCF services for each solution will be available for download on this website for you to examine, modify, and debug from the outside to the inside.

The book focuses on the essentials of using WCF and LINQ, 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.

Who this book is for

This book is for C# and C++ developers who are eager to get started with WCF and LINQ, 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.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software