Chapter 1. Learn LINQ and the C 3.0 Features That Support It


Chapter 1. Learn LINQ and the C# 3.0 Features That Support It

Imagine writing SQL-like queries entirely in C#, with IntelliSense and compile-time type checking. Imagine queries as flexible as dynamically-generated SQL, yet as secure and efficient as calling stored procedures. Now take these same queries and execute them against an XML document or against a collection of data objects. While Microsoft isn't quite there yet, this is the goal of the LINQ project.

Language Integrated Query (LINQ) is a C# 3.0 API centered on data access. Developers focused on data access will be able to leverage the LINQ API to interoperate with a variety of data sources and vendors in a consistent, object-oriented fashion. The LINQ API is also extensible, as demonstrated by Microsoft's most important components of LINQ, LINQ to SQL and LINQ to XML. The former provides LINQ-like manipulation of relational databases and the latter of XML documents. You can expect future componentsboth from Microsoft and developers like yourselfto extend LINQ in new and interesting ways.

The vast majority of LINQ is made possible by language extensions in C# 3.0 and VB 9.0, which will appear in the upcoming 3.0 release of .NET. However, LINQ will also require a new version of the .NET Framework, which will follow the upcoming 3.0 release. We shall tentatively refer to this version as .NET 3.5. The implication is that developers will need to redeploy on .NET 3.5 to use LINQ.

NOTE

LINQ is still in development, and will be released in an upcoming version of .NET (3.5?). In the meantime, you can experiment with LINQ by downloading the latest CTP for Visual Studio 2005 here: http://msdn.microsoft.com/data/ref/linq.

The material for this Short Cut is based on the May 2006 CTP of LINQ. Since LINQ is beta software, I encourage you to install Visual Studio 2005 and LINQ in a virtual environment, such as one created with Virtual PC.

The source code accompanying this Short Cut is available at either of the following URLs: http://www.oreilly.com/catalog/language1 or http://pluralsight.com/drjoe/pdfs/pdfs.aspx. To get started yourself, install the latest LINQ CTP, startup Visual Studio 2005, expand the project types for C#, and select "LINQ Preview." To see lots of examples of LINQ in action, try this site: http://msdn.microsoft.com/vcsharp/future/linqsamples.



LINQ[c] The Future of Data Access in C# 3. 0
LINQ[c] The Future of Data Access in C# 3. 0
ISBN: N/A
EAN: N/A
Year: 2006
Pages: 25

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net