|TABLE OF CONTENTS|
|Visual Studio 2008 and LINQ|
This section of the Visual Studio 2008 Learning Guide looks at LINQ. The Language Integrated Query is one of the most important new features introduced in Visual Studio 2008. It lets programmers make queries to any IEnumerable data type within their native .NET language; no longer must they use T-SQL syntax.
Here we first link to tips and tutorials about LINQ in general and about two more popular data query flavors -- LINQ to SQL and LINQ to XML. Then we look at the native .NET language changes that were needed to make LINQ work. The sections of the Visual Studio 2008 Learning Guide that follow dig a little deeper into those, and other changes, in Visual Basic 2008 and C# 3.0.
If you want a more in-depth look at LINQ, then you should check out our LINQ Learning Guide.
LINQ development, Part 1 (SearchWinDevelopment.com)
The Language Integrated Query integrates data queries right into VB 2008 and C# 3.0 and works with objects, XML and SQL. This tip highlights resources for getting to know LINQ.
LINQ development, Part 2 (SearchWinDevelopment.com)
LINQ, the Language Integrated Query, dramatically changes database programming in Visual Studio 2008. Here we examine the ins and outs of LINQ to SQL queries.
Learning LINQ to
SQL using Visual Basic 2008 (Jagadish Chararji)
As the title of the entry indicates, this blogger decided to build an application (in this case, an ASP.NET 3.5 Web site project), plug in several SQL SELECT statements and see how they could be expressed using LINQ.
to SQL and VS 2008 performance (David Hayden)
This blogger, who has penned several LINQ to SQL tutorials, wonders if LINQ queries do, in fact, perform better than does the SqlDataAdaptor.
to SQL: Sweet query and performance control (David Hayden)
Hayden was a little disappointed with LINQ to SQL performance, particularly when it came to heavy columns -- until he discovered "lazy loading," which ensures that heavy columns and other fields are not duplicated.
data access layer using LINQ to SQL: Stored procedures support (David Hayden)
Here Hayden discusses the use of stored procedures as an alternative to LINQ to SQL queries. Stored procedures may be a consideration if a programmer has performance concerns.
import, export Excel data with LINQ to XML (Beth Massi)
This article demonstrates how to get an Excel 2003 file into XML format and then import it using LINQ to XML. (The author chose Excel 2003 to prove that it'll work with the older version as well as with Excel 2007.)
to SQL Pipeline (Charlie Calvert)
In this video, Luca Bolognese and Matt Warren explain the SQL Pipeline, which transforms a LINQ query into SQL and returns a result to the user
*** In order to accommodate LINQ, Microsoft had to introduce some new features to Visual Basic 2008 and C# 3.0. The following articles introduce these four language-agnostic features and offer details on how well they work with Visual Studio 2008's multi-targeting.
VS 2008 language feature: Extension Methods (Scott Guthrie)
As Guthrie explains, "Extension methods allow developers to add new methods to the public contract of an existing CLR type, without having to sub-class it or recompile the original type. Extension Methods help blend the flexibility of 'duck typing' support popular within dynamic languages today with the performance and compile-time validation of strongly-typed languages."
VS 2008 language feature: Lambda Expressions (Scott Guthrie)
Again, as Guthrie explains, "Lambda Expressions provide a more concise, functional syntax for writing anonymous methods. They…provide a very compact and type-safe way to write functions that can be passed as arguments for subsequent evaluation."
VS 2008 language feature: Query syntax (Scott Guthrie)
Once again, Guthrie put it best: "Query syntax is a convenient declarative shorthand for expressing queries using the standard LINQ query operators. It offers a syntax that increases the readability and clarity of expressing queries in code, and can be easy to read and write correctly….Under the covers the C# and VB compilers take query syntax expressions and translate them into explicit method invocation code…"
VS 2008 language feature: Anonymous Types (Scott Guthrie)
To paraphrase Guthrie this time, Anonymous Types let programmers define CLR types within code, without establishing a formal class declaration of the type.
Using C# 3.0 from
.NET Framework 2.0 and Using Extension
Methods in .NET Framework 2.0 projects (Daniel Moth)
These articles provides an explanation as to what new LINQ features and implementations in Visual Studio 2008 will, and will not, work when programming in .NET 2.0.
*** Go on to the next section of the Visual Studio 2008 Learning Guide: Visual Studio 2008 and Visual Basic 2008
This was first published in November 2007