Thursday, December 13, 2007

Pro LINQ: Language Integrated Query in C# 2008

Apress has published their latest .NET book: Pro LINQ: Language Integrated Query in C# 2008
Author: Joseph C. Rattz, Jr.
ISBN10: 1-59059-789-3
ISBN13: 978-1-59059-789-7
600 pp.
Published on Nov 2007


LINQ is the project name for a set of extensions to the .NET Framework that provide a generic approach to querying data from different data sources. LINQ will premier in Visual Studio 2008, and will become the next must–have skill for .NET developers. For more information about LINQ, you can check out the author’s portal at www.linqdev.com.

Pro LINQ: Language Integrated Query in C# 2008 is all about code.

Literally, this book starts with code and ends with code. In most books, the author shows the simplest example demonstrating how to use a method, but they so rarely show how to use the more complex prototypes. Pro LINQ: Language Integrated Query in C# 2008 is different. Demonstrating the overwhelming majority of LINQ operators and protoypes, it is a veritable treasury of LINQ examples.

Rather than obscure the relevant LINQ principles in code examples by focusing on a demonstration application you have no interest in writing, Pro LINQ: Language Integrated Query in C# 2008 cuts right to the chase of each LINQ operator, method, or class. However, where complexity is necessary to truly demonstrate an issue, the examples are right there in the thick of it. For example, code samples demonstrating how to handle concurrency conflicts actually create concurrency conflicts so you can step through the code and see them unfold.

Most books tell you about the simple stuff, while few books warn you of the pitfalls. Where Pro LINQ: Language Integrated Query in C# 2008 returns your investment is in the hours, and sometimes days, spent by the author determining why something may not work as expected. Sometimes this results in an innocent looking paragraph that may take you a minute to read and understand, but took days to research and explain.

Table of contents:

PART 1 Pro LINQ: Language Integrated Query in C# 2008
CHAPTER 1 Hello LINQ
A Paradigm Shift
Query XML
Query a SQL Server Database
Introduction
LINQ Is About Data Queries
Components
How to Obtain LINQ
LINQ Is Not Just for Queries
Tips to Get You Started
Use the var Keyword When Confused
Use the Cast or OfType Operators for Legacy Collections
Prefer the OfType Operator to the Cast Operator
Don’t Assume a Query Is Bug-Free
Take Advantage of Deferred Queries
Use the DataContext Log
Use the LINQ Forum
Summary

CHAPTER 2 C# 3.0 Language Enhancements for LINQ
New C# 3.0 Language Additions
Lambda Expressions
Expression Trees
Keyword var, Object Initialization, and Anonymous Types
Extension Methods
Partial Methods
Query Expressions
Summary

PART 2 LINQ to Objects
CHAPTER 3 LINQ to Objects Introduction
LINQ to Objects Overview
IEnumerablelt;Tgt, Sequences, and the Standard Query Operators
Returning IEnumerablelt;Tgt;, Yielding, and Deferred Queries
Func Delegates
The Standard Query Operators Alphabetical Cross-Reference
Summary

CHAPTER 4 Deferred Operators
Referenced Namespaces
Referenced Assemblies
Common Classes
The Deferred Operators by Purpose
Restriction
Projection
Partitioning
Concatenation
Ordering
Join
Grouping
Set
Conversion
Element
Generation
Summary

CHAPTER 5 Nondeferred Operators
Referenced Namespaces
Common Classes
The Nondeferred Operators by Purpose
Conversion
Equality
Element
Quantifiers
Aggregate
Summary


PART 3 LINQ to XML
CHAPTER 6 LINQ to XML Introduction
Introduction
Cheating the W3C DOM XML API
Summary

CHAPTER 7 The LINQ to XML API
Referenced Namespaces
Significant API Design Enhancements
XML Tree Construction Simplified with Functional Construction
Document Centricity Eliminated in Favor of Element Centricity
Names, Namespaces, and Prefixes
Node Value Extraction
The LINQ to XML Object Model
Deferred Query Execution, Node Removal, and the Halloween Problem
XML Creation
Creating Elements with XElement
Creating Attributes with XAttribute
Creating Comments with XComment
Creating Containers with XContainer
Creating Declarations with XDeclaration
Creating Document Types with XDocumentType
Creating Documents with XDocument
Creating Names with XName
Creating Namespaces with XNamespace
Creating Nodes with XNode
Creating Processing Instructions with XProcessingInstruction
Creating Streaming Elements with XStreamingElement
Creating Text with XText
Creating CData with XCData
XML Output
Saving with XDocument.Save()
Saving with XElement.Save()
XML Input
Loading with XDocument.Load()
Loading with XElement.Load()
Parsing with XDocument.Parse() or XElement.Parse()
XML Traversal
Traversal Properties
Traversal Methods
XML Modification
Adding Nodes
Deleting Nodes
Updating Nodes
XElement.SetElementValue() on Child XElement Objects
XML Attributes
Attribute Creation
Attribute Traversal
Attribute Modification
XML Annotations
Adding Annotations with XObject.AddAnnotation()
Accessing Annotations with XObject.Annotation() or XObject.Annotations()
Removing Annotations with XObject.RemoveAnnotations()
Annotations Example
XML Events
XObject.Changing
XObject.Changed
A Couple of Event Examples
Trick or Treat, or Undefined?
Summary

CHAPTER 8 LINQ to XML Operators
Introduction to LINQ to XML Operators
Ancestors
Prototypes
Examples
AncestorsAndSelf
Prototypes
Examples
Attributes
Prototypes
Examples
DescendantNodes
Prototypes
Examples
DescendantNodesAndSelf
Prototypes
Examples
Descendants
Prototypes
Examples
DescendantsAndSelf
Prototypes
Examples
Elements
Prototypes
Examples
InDocumentOrder
Prototypes
Examples
Nodes
Prototypes
Examples
Remove
Prototypes
Examples
Summary

CHAPTER 9 Additional XML Capabilities
Referenced Namespaces
Queries
No Reaching
A Complex Query
Transformations
Transformations Using XSLT
Transformations Using Functional Construction
Tips
Validation
The Extension Methods
Prototypes
Obtaining an XML Schema
Examples
XPath
Prototypes
Examples
Summary


PART 4 LINQ to DataSet
CHAPTER 10 LINQ to DataSet Operators
Assembly References
Referenced Namespaces
Common Code for the Examples
DataRow Set Operators
Distinct
Except
Intersect
Union
SequenceEqual
DataRow Field Operators
Fieldlt;Tgt;
SetFieldlt;Tgt;
DataTable Operators
AsEnumerable
CopyToDataTablelt;DataRowgt;
Summary

CHAPTER 11 Additional DataSet Capabilities
Required Namespaces
Typed DataSets
Putting It All Together
Summary


PART 5 LINQ to SQL
CHAPTER 12 LINQ to SQL Introduction
Introducing LINQ to SQL
The DataContext
Entity Classes
Associations
Concurrency Conflict Detection
Concurrency Conflict Resolution
Prerequisites for Running the Examples
Obtaining the Appropriate Version of the Northwind Database
Generating the Northwind Entity Classes
Generating the Northwind XML Mapping File
Using the LINQ to SQL API
IQueryablelt;Tgt;
Some Common Methods
GetStringFromDb()
ExecuteStatementInDb()
Summary

CHAPTER 13 LINQ to SQL Tips and Tools
Introduction to LINQ to SQL Tips and Tools
Tips
Use the DataContext.Log Property
Use the GetChangeSet() Method
Consider Using Partial Classes or Mapping Files
Consider Using Partial Methods
Tools
SQLMetal
The Object Relational Designer
Use SQLMetal and the O/R Designer Together
Summary

CHAPTER 14 LINQ to SQL Database Operations
Prerequisites for Running the Examples
Some Common Methods
Using the LINQ to SQL API
Standard Database Operations
Inserts
Queries
Updates
Deletes
Overriding Database Modification Statements
Overriding the Insert Method
Overriding the Update Method
Overriding the Delete Method
Example
Overriding in the Object Relational Designer
Considerations
SQL Translation
Summary

CHAPTER 15 LINQ to SQL Entity Classes
Prerequisites for Running the Examples
Entity Classes
Creating Entity Classes
XML External Mapping File Schema
Projecting into Entity Classes vs. Nonentity Classes
Extending Entity Classes with Partial Methods
Important System.Data.Linq API Classes
EntitySetlt;Tgt;
EntityReflt;Tgt;
Tablelt;Tgt;
IExecuteResult
ISingleResultlt;Tgt;
IMultipleResults
Summary

CHAPTER 16 The DataContext
Prerequisites for Running the Examples
Some Common Methods
Using the LINQ to SQL API
[Your]DataContext Class
The DataContext Class
Primary Purposes
DataContext() and [Your]DataContext()
SubmitChanges()
DatabaseExists()
CreateDatabase()
DeleteDatabase()
CreateMethodCallQuery()
ExecuteQuery()
Translate()
ExecuteCommand()
ExecuteMethodCall()
GetCommand()
GetChangeSet()
GetTable()
Refresh()
Summary

CHAPTER 17 Concurrency Conflicts
Prerequisites for Running the Examples
Some Common Methods
Using the LINQ to SQL API
Concurrency Conflicts
Optimistic Concurrency
Pessimistic Concurrency
An Alternative Approach for Middle Tiers and Servers
Summary

CHAPTER 18 Additional SQL Capabilities
Prerequisites for Running the Examples
Using the LINQ to SQL API
Using the LINQ to XML API
Database Views
Entity Class Inheritance
Transactions
Summary

INDEX


Sample Chapter: Ch. 01 - Hello LINQ
Amazon Link: Pro LINQ: Language Integrated Query in C# 2008

No comments: