Book Image

WCF Multi-tier Services Development with LINQ

By : Mike Liu
Book Image

WCF Multi-tier Services Development with LINQ

By: Mike Liu

Overview of this book

<p>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.<br /><br />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.<br /><br />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.<br /><br />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.</p>
Table of Contents (19 chapters)
WCF Multi-tier Services Development with LINQ
Credits
About the Author
About the Reviewers
Preface
Index

Comparing LINQ to SQL with LINQ to Objects


In the previous chapter, we used LINQ to query in-memory objects. Before we dive further into the world of LINQ to SQL, we first need to look at the relationships between LINQ to SQL and LINQ to Objects.

Some key differences between LINQ to SQL and LINQ to Objects are:

  • LINQ to SQL needs a Data Context object. The DataContext object is the bridge between LINQ and the database. LINQ to Objects doesn't need any intermediate LINQ provider or API.

  • LINQ to SQL returns data of type IQueryable<T> whereas LINQ to Objects returns data of type IEnumerable<T>.

  • LINQ to SQL queries are translated to SQL by way of Expression Trees, which allow them to be evaluated as a single unit, and translated to appropriate and optimal SQL Statements. LINQ to Objects queries do not need to be translated.

  • LINQ to SQL queries are translated to SQL calls and executed on the specified Database while LINQ to Objects queries are executed in the local machine memory.

The...