Ebooks-Programming Microsoft LINQ in Microsoft .NET Framework 4

Programming Microsoft LINQ in Microsoft .NET Framework 4
by: Paolo Pialorsi, Marco Russo

md5: d59be1878ccc98d453b9f340851a8760
size: 9.98 MB [ 10469865 bytes ]
type: .pdf
status: normal
language: en [ english ]
submitted by: anonymous


0735640572
9780735640573

metadata:

year: 2010
pages: 681



external links: tip: use 7zip to decompress/decrypt all linked archives

no password required ifile.it




description: ( ? )



Dig into LINQ -- and transform the way you work with data. With LINQ, you can query data from a variety of sources -- including databases, objects, and XML files -- directly from Microsoft Visual Basic® or C#. Guided by data-access experts who've worked in depth with LINQ and the Microsoft development teams, you'll learn how .NET Framework 4 implements LINQ, and how to exploit it. Clear examples show you how to deliver your own data-access solutions faster and with leaner code. Discover how to: Use LINQ to query databases, object collections, arrays, XML, Microsoft Excel® files, and other sources Apply LINQ best practices to build data-enabled .NET applications and services Manipulate data in a relational database with ADO.NET Entity Framework or LINQ to SQL Read, write, and manage XML content more efficiently with LINQ to XML Extend LINQ to support additional data sources by creating custom operators and providers Examine other implementations, such as LINQ to SharePoint® Use LINQ within the data, business, and service layers of a distributed application Get code samples on the Web.



Table of Contents
Table of Contents
Preface
Acknowledgments
Introduction
LINQ Foundations
Chapter 1. LINQ Introduction
What Is LINQ?
Why Do We Need LINQ?
How LINQ Works
Relational Model vs. Hierarchical/Network Model
XML Manipulation
Language Integration
Declarative Programming
Type Checking
Transparency Across Different Type Systems
LINQ Implementations
LINQ to Objects
LINQ to ADO.NET
LINQ to XML
Summary
Chapter 2. LINQ Syntax Fundamentals
LINQ Queries
Query Syntax
Full Query Syntax
Query Keywords
From Clause
Where Clause
Select Clause
Group and Into Clauses
Orderby Clause
Join Clause
Let Clause
Additional Visual Basic Keywords
Deferred Query Evaluation and Extension Method Resolution
Deferred Query Evaluation
Extension Method Resolution
Some Final Thoughts About LINQ Queries
Degenerate Query Expressions
Exception Handling
Summary
Chapter 3. LINQ to Objects
Query Operators
The Where Operator
Projection Operators
Ordering Operators
Grouping Operators
Join Operators
Set Operators
Aggregate Operators
Aggregate Operators in Visual Basic
Generation Operators
Quantifier Operators
Partitioning Operators
Element Operators
Other Operators
Conversion Operators
AsEnumerable
ToArray and ToList
ToDictionary
ToLookup
OfType and Cast
Summary
LINQ to Relational
Chapter 4. Choosing Between LINQ to SQL and LINQ to Entities
Comparison Factors
When to Choose LINQ to Entities and the Entity Framework
When to Choose LINQ to SQL
Other Considerations
Summary
LINQ to SQL: Querying Data
Entities in LINQ to SQL
External Mapping
Data Modeling
DataContext
Entity Classes
Entity Inheritance
Unique Object Identity
Entity Constraints
Associations Between Entities
Relational Model vs. Hierarchical Model
Data Querying
Projections
Stored Procedures and User-Defined Functions
Compiled Queries
Different Approaches to Querying Data
Direct Queries
Deferred Loading of Entities
Deferred Loading of Properties
Read-Only DataContext Access
Limitations of LINQ to SQL
Thinking in LINQ to SQL
The IN/EXISTS Clause
SQL Query Reduction
Mixing .NET Code with SQL Queries
Summary
Chapter 6. LINQ to SQL: Managing Data
CRUD and CUD Operations
Entity Updates
Database Updates
Customizing Insert, Update, and Delete
Database Interaction
Concurrent Operations
Transactions
Exceptions
Databases and Entities
Entity Attributes to Maintain Valid Relationships
Deriving Entity Classes
Attaching Entities
Binding Metadata
Differences Between the .NET Framework and SQL Type Systems
Summary
Chapter 7. LINQ to SQL: Modeling Data and Tools
File Types
DBML—Database Markup Language
C# and Visual Basic Source Code
XML—External Mapping File
LINQ to SQL File Generation
SQLMetal
Generating a DBML File from a Database
Generating Source Code and a Mapping File from a Database
Generating Source Code and a Mapping File from a DBML File
Using the Object Relational Designer
DataContext Properties
Entity Class
Association Between Entities
Entity Inheritance
Stored Procedures and User-Defined Functions
Views and Schema Support
Summary
Chapter 8. LINQ to Entities: Modeling Data with Entity Framework
The Entity Data Model
Generating a Model from an Existing Database
Starting from an Empty Model
Generated Code
Entity Data Model (.edmx) Files
Associations and Foreign Keys
Complex Types
Inheritance and Conditional Mapping
Modeling Stored Procedures
Non-CUD Stored Procedures
CUD Stored Procedures
POCO Support
T4 Templates
Summary
LINQ to Entities: Querying Data
EntityClient Managed Providers
LINQ to Entities
Selecting Single Entities
Unsupported Methods and Keywords
Canonical and Database Functions
User-Defined Functions
Stored Procedures
ObjectQuery and ObjectContext
Lazy Loading
Include
Load and IsLoaded
The LoadProperty Method
MergeOption
The ToTraceString Method
ExecuteStoreCommand and ExecuteStoreQuery
The Translate Method
Query Performance
Pre-Build Store Views
EnablePlanCaching
Pre-Compiled Queries
Tracking vs. No Tracking
Summary
Chapter 10. LINQ to Entities: Managing Data
Managing Entities
Adding a New Entity
Updating an Entity
Deleting an Entity
Using SaveChanges
Cascade Add/Update/Delete
Managing Relationships
Using ObjectStateManager and EntityState
DetectChanges and AcceptAllChanges
ChangeObjectState and ChangeRelationshipState
ObjectStateManagerChanged
EntityKey
GetObjectByKey and TryGetObjectByKey
Managing Concurrency Conflicts
Managing Transactions
Detaching, Attaching, and Serializing Entities
Detaching Entities
Attaching Entities
ApplyOriginalValues and ApplyCurrentValues
Serializing Entities
Using Self-Tracking Entities
Summary
Chapter 11. LINQ to DataSet
Introducing LINQ to DataSet
Using LINQ to Load a DataSet
Loading a DataSet with LINQ to SQL
Loading Data with LINQ to DataSet
Using LINQ to Query a DataSet
Understanding DataTable.AsEnumerable
Creating DataView Instances with LINQ
Using LINQ to Query a Typed DataSet
Accessing Untyped DataSet Data
Comparing DataRow Instances
Summary
LINQ to XML
Chapter 12. LINQ to XML: Managing the XML Infoset
Introducing LINQ to XML
LINQ to XML Programming
XDocument
XElement
XAttribute
XNode
XName and XNamespace
Other X* Classes
XStreamingElement
XObject and Annotations
Reading, Traversing, and Modifying XML
Summary
Chapter 13. LINQ to XML: Querying Nodes
Querying XML
Attribute, Attributes
Element, Elements
XPath Axes “Like” Extension Methods
XNode Selection Methods
InDocumentOrder
Understanding Deferred Query Evaluation
Using LINQ Queries over XML
Querying XML Efficiently to Build Entities
Transforming XML with LINQ to XML
Support for XSD and Validation of Typed Nodes
Support for XPath and System.Xml.XPath
Securing LINQ to XML
Serializing LINQ to XML
Summary
Advanced LINQ
Chapter 14. Inside Expression Trees
Lambda Expressions
What Is an Expression Tree?
Creating Expression Trees
Encapsulation
Immutability and Modification
Dissecting Expression Trees
The Expression Class
Expression Tree Node Types
Practical Nodes Guide
Visiting an Expression Tree
Dynamically Building an Expression Tree
How the Compiler Generates an Expression Tree
Combining Existing Expression Trees
Dynamic Composition of an Expression Tree
Summary
Chapter 15. Extending LINQ
Custom Operators
Specialization of Existing Operators
Dangerous Practices
Limits of Specialization
Creating a Custom LINQ Provider
The IQueryable Interface
From IEnumerable to IQueryable and Back
Inside IQueryable and IQueryProvider
Writing the FlightQueryProvider
Summary
Chapter 16. Parallelism and Asynchronous Processing
Task Parallel Library
The Parallel.For and Parallel.ForEach Methods
The Parallel.Invoke Method
The Task Class
The Task Class
Controlling Task Execution
Using Tasks for Asynchronous Operations
Concurrency Considerations
PLINQ
Threads Used by PLINQ
Implementing PLINQ
Consuming the Result of a PLINQ Query
Controlling Result Order in PLINQ
Processing Query Results
Handling Exceptions with PLINQ
Canceling a PLINQ Query
Controlling Execution of a PLINQ Query
Changes in Data During Execution
PLINQ and Other LINQ Implementations
Reactive Extensions for .NET
Summary
Chapter 17. Other LINQ Implementations
Database Access and ORM
Data Access Without a Database
LINQ to SharePoint Examples
LINQ to Services
LINQ for System Engineers
Dynamic LINQ
Other LINQ Enhancements and Tools
Summary
Applied LINQ
Chapter 18. LINQ in a Multitier Solution
Characteristics of a Multitier Solution
LINQ to SQL in a Two-Tier Solution
LINQ in an n-Tier Solution
Using LINQ to SQL as a DAL Replacement
Abstracting LINQ to SQL with XML External Mapping
Using LINQ to SQL Through Real Abstraction
Using LINQ to XML as the Data Layer
Using LINQ to Entities as the Data Layer
LINQ in the Business Layer
Using LINQ to Objects to Write Better Code
IQueryable vs. IEnumberable
Identifying the Right Unit of Work
Handling Transactions
Concurrency and Thread Safety
Summary
Chapter 19. LINQ Data Binding
Using LINQ with ASP.NET
Using LinqDataSource
Using EntityDataSource
Binding to LINQ Queries
Using LINQ with WPF
Binding Single Entities and Properties
Binding Collections of Entities
Using LINQ with Silverlight
Using LINQ with Windows Forms
Summary
Index
Index


Tags: linq, wpf, windows presentation foundation, c#, csharp, c sharp, .net, dotnet, microsoft