Get comprehensive guidance for using the Microsoft Language Integrated Query (LINQ) Project—with in-depth insights from two experienced developers. Data-rich applications can be difficult to create because of the tremendous differences between query languages used to access data and the programming languages commonly used to write applications. This practical guide covers the intricacies of LINQ, a set of extensions to the Visual C# and Visual Basic programming languages. Instead of traversing different language syntaxes required for accessing data from relational and hierarchical data sources, developers will learn how to write queries natively in Visual C# or Visual Basic—helping reduce complexity and boost productivity. Written by two experienced developers with strong ties to the developer teams at Microsoft, this book describes the LINQ architecture and classes, details the new language features in both Visual C# and Visual Basic, and provides code samples in both languages.
LINQ Foundations
Chapter 1 LINQ Introduction
What Is LINQ?
Why Do We Need LINQ?
How LINQ Works
Language Integration
LINQ Implementations
Summary
Chapter 2 LINQ Syntax Fundamentals
LINQ Queries
Query Keywords
Deferred Query Evaluation and Extension Method Resolution
Some Final Thoughts About LINQ Queries
Summary
Chapter 3 LINQ to Objects
Query Operators
Conversion Operators
Summary
LINQ to Relational Data
Chapter 4 LINQ to SQL: Querying Data
Entities in LINQ to SQL
Data Modeling
Data Querying
Thinking in LINQ to SQL
Summary
Chapter 5 LINQ to SQL: Managing Data
CRUD and CUD Operations
Database Interaction
Database and Entities
Summary
Chapter 6 Tools for LINQ to SQL
File Types
SQLMetal
Using the Object Relational Designer
Summary
Chapter 7 LINQ to DataSet
Introducing LINQ to DataSet
Using LINQ to Load a DataSet
Using LINQ to Query a DataSet
Summary
Chapter 8 LINQ to Entities
Querying Entity Data Model
Managing Data
Query Engine
LINQ to SQL and LINQ to Entities
Summary
LINQ and XML
Chapter 9 LINQ to XML: Managing the XML Infoset
Introducing LINQ to XML
LINQ to XML Programming
Reading, Traversing, and Modifying XML
Summary
Chapter 10 LINQ to XML: Querying Nodes
Querying XML
Deferred Query Evaluation
LINQ Queries over XML
Transforming XML with LINQ to XML
Support for XSD and Validation of Typed Nodes
Support for XPath and System.Xml.XPath
LINQ to XML Security
LINQ to XML Serialization
Summary
Advanced LINQ
Chapter 11 Inside Expression Trees
Lambda Expressions
What Is an Expression Tree
Dissecting Expression Trees
Visiting an Expression Tree
Dynamically Building an Expression Tree
Summary
Chapter 12 Extending LINQ
Custom Operators
Specialization of Existing Operators
Creating a Custom LINQ Provider
Summary
Chapter 13 Parallel LINQ
Parallel Extensions to the .NET Framework
Using PLINQ
Summary
Chapter 14 Other LINQ Implementations
Database Access
Data Access Without a Database
LINQ to Entity Domain Models
LINQ to Services
LINQ for System Engineers
Dynamic LINQ
Other LINQ Enhancements and Tools
Summary
Applied LINQ
Chapter 15 LINQ in a Multitier Solution
Characteristics of a Multitier Solution
LINQ to SQL in a Two-Tier Solution
LINQ in an n-Tier Solution
LINQ in the Business Layer
Summary
Chapter 16 LINQ and ASP.NET
ASP.NET 3.5
LinqDataSource
Binding to LINQ queries
Summary
Chapter 17 LINQ and WPF/Silverlight
Using LINQ with WPF
Using LINQ with Silverlight
Summary
Chapter 18 LINQ and the Windows Communication Foundation
WCF Overview
WCF and LINQ to SQL
LINQ to Entities and WCF
Query Expression Serialization
Summary
Appendixes
Appendix ADO.NET Entity Framework
ADO.NET Standard Approach
Abstracting from the Physical Layer
Entity Data Modeling
Querying Entities with ADO.NET
Querying ADO.NET Entities with LINQ
Managing Data with Object Services
Manually Implemented Entities
LINQ to SQL and ADO.NET Entity Framework
Summary
Appendix C# 3.0: New Language Features
C# 2.0 Revisited
C# 3.0 Features
Summary
Appendix Visual Basic 2008: New Language Features
Visual Basic 2008 and Nullable Types
The If Operator
Visual Basic 2008 Features Corresponding to C# 3.0
Visual Basic 2008 Features Without C# 3.0 Counterparts
C# 3.0 Features Without Visual Basic 2008 Counterparts
Paolo Pialorsi is a consultant, trainer, and author who specializes in developing distributed applications architectures and Microsoft SharePoint enterprise solutions. He is the author of Programming Microsoft LINQ and Introducing Microsoft LINQ (Microsoft Press), and has written three Italian-language books about XML and Web Services. Paolo is one of the content owners of the Italian edition of the Microsoft SharePoint Conference, and a popular speaker at industry conferences.
MARCO RUSSO is a software consultant and trainer based in Italy who focuses on Windows development and Business Intelligence solutions, including data warehouse relational and multidimensional design. He is the coauthor of Introducing Microsoft LINQ and Programming Microsoft LINQ (Microsoft Press), along with several other books about Microsoft .NET and SQL Server Analysis Services.