Essential LINQ (Microsoft .NET Development Series)

( 2 )

Overview

“Charlie and Dinesh bring important skills to this project that enable them to show how LINQ works and the practical ways you can use it in your daily development process.”

From the Foreword by Anders Hejlsberg

LINQ is one of Microsoft’s most exciting, powerful new development technologies. Essential LINQ is the first LINQ book written by leading members of Microsoft’s LINQ and C# teams. Writing for architects, developers, and development managers, these Microsoft insiders share...

See more details below
Other sellers (Paperback)
  • All (12) from $17.49   
  • New (6) from $29.66   
  • Used (6) from $17.49   
Essential LINQ

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study

Want a NOOK? Explore Now

NOOK Book (eBook)
$19.99
BN.com price
(Save 44%)$35.99 List Price

Overview

“Charlie and Dinesh bring important skills to this project that enable them to show how LINQ works and the practical ways you can use it in your daily development process.”

From the Foreword by Anders Hejlsberg

LINQ is one of Microsoft’s most exciting, powerful new development technologies. Essential LINQ is the first LINQ book written by leading members of Microsoft’s LINQ and C# teams. Writing for architects, developers, and development managers, these Microsoft insiders share their intimate understanding of LINQ, revealing new patterns and best practices for getting the most out of it.

Calvert and Kulkarni begin by clearly explaining how LINQ resolves the long-time “impedance mismatch” between object-oriented code and relational databases. Next, they show how LINQ integrates querying into C# as a “first-class citizen.” Using realistic code examples, they show how LINQ provides a strongly typed, IntelliSense-aware technology for working with data from any source, including SQL databases, XML files, and generic data structures.

Calvert and Kulkarni carefully explain LINQ’s transformative, composable, and declarative capabilities. By fully illuminating these three concepts, the authors allow developers to discover LINQ’s full power. In addition to covering core concepts and hands-on LINQ development in C# with LINQ to Objects, LINQ to XML, LINQ to SQL, and LINQ to Entities, they also present advanced topics and new LINQ implementations developed by the LINQ community. This book

• Explains the entire lifecycle of a LINQ project: design, development, debugging, and much more

• Teaches LINQ from both a practical and theoretical perspective

• Leverages C# language features that simplify LINQ development

• Offers developers powerful LINQ query expressions to perform virtually any data-related task

• Teaches how to query SQL databases for objects and how to modify those objects

• Demonstrates effective use stored procedures and database functions with LINQ

• Shows how to add business logic that reflects the specific requirements of your organization

• Teaches developers to create, query, and transform XML data with LINQ

• Shows how to transform object, relational, and XML data between each other

• Offers best patterns and practices for writing robust, easy-to-maintain LINQ code

Read More Show Less

Product Details

  • ISBN-13: 9780321564160
  • Publisher: Addison-Wesley
  • Publication date: 3/26/2009
  • Series: Microsoft .NET Development Series
  • Pages: 564
  • Product dimensions: 6.90 (w) x 9.10 (h) x 1.30 (d)

Meet the Author

Charlie Calvert, Community Program Manager for the Microsoft C# team, currently focuses his technical energies on LINQ. He has periodically worked with LINQ Chief Architect Anders Hejlsberg both during the development of Delphi and during the development of LINQ. Calvert’s ten technical books have sold more than 100,000 copies. They include Delphi 4 Unleashed, C++Builder 3 Unleashed, Delphi 2 Unleashed, Teach Yourself Windows 95 Programming in 21 Days, and Teach Yourself Windows Programming.

Dinesh Kulkarni is a Senior Program Manager on Microsoft’s .NET Framework team. He was the Program Manager in charge of LINQ to SQL. He was deeply involved in LINQ’s planning and implementation from the incubation stage and was lead author for MSDN’s authoritative LINQ to SQL paper. Before joining Microsoft, he worked in diverse technical roles ranging from architecting and implementing front-end CASE tools for IBM to designing databases and middleware for a Wall Street hedge fund.

Read More Show Less

Read an Excerpt

ForewordForeword

For years I have been fascinated with the differences between general-purpose programming languages and databases. Practically every enterprise application built today is coded in a general-purpose programming language and talks to a database, yet the two ecosystems are amazingly different and quite poorly integrated—the impedance mismatch between object-oriented programming and the relational model is the gift that keeps on giving when it comes to application complexity.

But the thing I find particularly puzzling is the lack of query capabilities in general-purpose programming languages. Why is it you can query database tables but not in-memory objects? Why are XPath and XQuery so arbitrarily different from SQL? Why is it so hard to transform data between the object, relational, and

LINQ extends the .NET Framework and programming languages with a uniform model for querying and transforming in-memory collections, relational data, and

LINQ was a very interesting and unique project to work on. One reason is that it wasn’t just about language features. In order to gain experience with the query capabilities we were developing, we needed to validate them against the important data domains—objects, relational, and

Also, LINQ isn’t just a single monolithic language feature, but rather a collection of several smaller and individually useful features—such as lambda expressions, extension methods, expression trees, object initializers, and anonymous types—that all come together to form the concept of Language Integrated Query. This made our work much more relevant and leveraged.

Finally, LINQ is big step toward a more declarative style of programming. This may be subtle, but it is really important. Programs written in today’s imperative programming languages are too much about the “how” and too little about the “what.” We tend to over-specify the solutions to our programming problems—for example, by deconstructing queries into for loops, if statements, manipulation of temporary collections, and so on. By the time such programs run, it is all but impossible for the execution environment to “understand” what they do. The higher level semantic meaning has been lost in a sea of imperative, low-level instructions that must be blindly executed in exact sequence. This contrasts with LINQ queries, which preserve the programmer’s exact intent and allows the execution infrastructure to be much smarter. A great example here is the Parallel LINQ (PLINQ) API that parallelizes query execution on concurrent hardware with practically no changes required to the source code.

Of course, the creation of a new technology such as LINQ is really only the first part of our job. The next step is to find ways to explain our new technology to the world of developers.

Essential LINQ is an important book because it provides a clear, easy-to-understand explanation of what LINQ does, how it does it, and the many practical ways you can use this technology to make your daily programming life easier and more productive.

Both authors of this text bring an important set of skills to this project. Throughout the development of LINQ, I worked daily with Dinesh Kulkarni in this role as Program Manager for the LINQ to SQL project. Few understand LINQ to SQL better than Dinesh, and the many insights he provides into LINQ will prove to be an invaluable tool for any reader of this book. The chapters Dinesh contributed to this book will be a resource that developers will frequently mine for their rich, well-thought-out content.

I’ve known Charlie Calvert since we worked together on Turbo Pascal and Delphi at Borland International. Charlie is an accomplished author with a gift for finding the key threads in a technology and explaining them to readers in a clear, easy-to-understand prose style. He is also one of nicest people I’ve met.

Charlie and Dinesh each bring important skills to this project that have enabled them to create an excellent book that shows how LINQ works and the many practical ways you can use it in your daily development process.

Anders Hejlsberg Redmond, WA February 2009

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Table of Contents

Foreword xxi

Acknowledgments xxv

About the Authors xxix

Chapter 1 Introduction 1

Chapter 2 Getting Started 13

Chapter 3 The Essence of LINQ 39

Chapter 4 C# 3.0 Technical Overview 65

Chapter 5 Writing Query Expressions 129

Chapter 6 Query Operators 175

Chapter 7 A Quick Tour of LINQ to SQL 231

Chapter 8 Reading Objects with LINQ to SQL 247

Chapter 9 Modifying Objects with LINQ to SQL 281

Chapter 10 Using Stored Procedures and Database Functions with LINQ to SQL 319

Chapter 11 Customizing Entity Persistence and Adding Business Logic 337

Chapter 12 LINQ to Entities Overview 349

Chapter 13 LINQ to XML: Creation 369

Chapter 14 Querying and Editing XML 387

Chapter 15 XML Namespaces, Transforms, and Schema Validation 423

Chapter 16 Introduction to LINQ Patterns and Practices 465

Chapter 17 LINQ Everywhere 487

Chapter 18 Conclusion 515

Appendix A Tips for Developers 519

Index 547

Read More Show Less

Preface

ForewordForeword

For years I have been fascinated with the differences between general-purpose programming languages and databases. Practically every enterprise application built today is coded in a general-purpose programming language and talks to a database, yet the two ecosystems are amazingly different and quite poorly integrated—the impedance mismatch between object-oriented programming and the relational model is the gift that keeps on giving when it comes to application complexity.

But the thing I find particularly puzzling is the lack of query capabilities in general-purpose programming languages. Why is it you can query database tables but not in-memory objects? Why are XPath and XQuery so arbitrarily different from SQL? Why is it so hard to transform data between the object, relational, and XML domains? These are the kinds of questions that launched us on the Language Integrated Query (LINQ) journey. Along the way we got wise to the wonders of functional programming, lambda expressions, type inference, monads, O/R mapping, and all sorts of fascinating computer science. Fortunately, we managed to boil our learnings down to a set of pragmatic language features and APIs that are useful in practically any .NET application.

LINQ extends the .NET Framework and programming languages with a uniform model for querying and transforming in-memory collections, relational data, and XML documents. With LINQ, C# 3.0 and VB 9.0 gain the expressive power of SQL and XQuery to become the first general-purpose programming languages to natively support queries and transformations over all classes of data.

LINQ was a very interesting and unique project to workon. One reason is that it wasn’t just about language features. In order to gain experience with the query capabilities we were developing, we needed to validate them against the important data domains—objects, relational, and XML. That led us to create the LINQ to Objects, LINQ to SQL, and LINQ to XML APIs, all of which were built alongside the language features. The synergy and agility we got from having a joint team working on both language and APIs was just amazing—and loads of fun!

Also, LINQ isn’t just a single monolithic language feature, but rather a collection of several smaller and individually useful features—such as lambda expressions, extension methods, expression trees, object initializers, and anonymous types—that all come together to form the concept of Language Integrated Query. This made our work much more relevant and leveraged.

Finally, LINQ is big step toward a more declarative style of programming. This may be subtle, but it is really important. Programs written in today’s imperative programming languages are too much about the “how” and too little about the “what.” We tend to over-specify the solutions to our programming problems—for example, by deconstructing queries into for loops, if statements, manipulation of temporary collections, and so on. By the time such programs run, it is all but impossible for the execution environment to “understand” what they do. The higher level semantic meaning has been lost in a sea of imperative, low-level instructions that must be blindly executed in exact sequence. This contrasts with LINQ queries, which preserve the programmer’s exact intent and allows the execution infrastructure to be much smarter. A great example here is the Parallel LINQ (PLINQ) API that parallelizes query execution on concurrent hardware with practically no changes required to the source code.

Of course, the creation of a new technology such as LINQ is really only the first part of our job. The next step is to find ways to explain our new technology to the world of developers.

Essential LINQ is an important book because it provides a clear, easy-to-understand explanation of what LINQ does, how it does it, and the many practical ways you can use this technology to make your daily programming life easier and more productive.

Both authors of this text bring an important set of skills to this project. Throughout the development of LINQ, I worked daily with Dinesh Kulkarni in this role as Program Manager for the LINQ to SQL project. Few understand LINQ to SQL better than Dinesh, and the many insights he provides into LINQ will prove to be an invaluable tool for any reader of this book. The chapters Dinesh contributed to this book will be a resource that developers will frequently mine for their rich, well-thought-out content.

I’ve known Charlie Calvert since we worked together on Turbo Pascal and Delphi at Borland International. Charlie is an accomplished author with a gift for finding the key threads in a technology and explaining them to readers in a clear, easy-to-understand prose style. He is also one of nicest people I’ve met.

Charlie and Dinesh each bring important skills to this project that have enabled them to create an excellent book that shows how LINQ works and the many practical ways you can use it in your daily development process.

Anders Hejlsberg
Redmond, WA
February 2009


© Copyright Pearson Education. All rights reserved.

Read More Show Less

Customer Reviews

Average Rating 3.5
( 2 )
Rating Distribution

5 Star

(0)

4 Star

(1)

3 Star

(1)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Posted April 14, 2009

    more from this reviewer

    C#'s answer to Java and Hibernate?

    Linq is an interesting new capability added to C#, according to the book. It extends the ability of C# and .NET to access data. Eventually, other languages supported by .NET can be expected to have Linq.

    The problem is the impedance mismatch between any object oriented language and a relational database. In Java, Hibernate addresses this issue. Linq is the C# analog. But Linq goes further in some ways, by letting queries to XML data and to sets of C# classes be written in the same manner as for querying SQL. This unified notation can ease the programmer's job. Though perhaps it should be said, since the book doesn't seem to do so, that the impedance mismatch between OO and XML or a set of classes within the OO language is fairly minimal. Reading in XML from a file gives data that is [often] inherently a set of objects. While if you have a set of object classes within an OO language, then surely there is no mismatch. Which is why these haven't been big issues within java or C++. Granted, the unified notation of Linq is still handy to support all 3 cases.

    The practical reality is that most data is stored in SQL, and the book devotes 4 chapters to explaining Linq to SQL. If you are going to use Linq, it's these chapters you need.

    Another advantage of Linq is in the declarative nature of the queries. At least in spirit this mimics SQL. More to the point, it frees up some of the burden from the programmer, by reducing the amount of imperative code she has to write. Which also reduces the chances of bugs in that code.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Posted July 13, 2009

    I Also Recommend:

    Good book to start getting pumped with LINQ

    I've been doing LINQ for about a year now and this book was really good to give me new ideas, and by showing different approaches to the same solution to learn different types of syntax.
    I specifically liked the more advanced chapters because they helped me advanced in my LINQ knowledge. The examples are carefully shown and clear that make everything so simple and easy to understand even when defining the concept may be a bit hard for the person with hardly any LINQ knowledge.
    This book is really good because it has great information and one of the greatest technologies made by Microsoft in the last few years. LINQ is great and if you are learning about it this is a great book that will get you started and point out all the strengths and solutions in an elegant manner.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)