The LINQ Project: Visual Basic
Microsoft .NET Language-Integrated Query

 

 

 

 

 

 

 

 

 

 

 

 

Microsoft .NET LINQ Preview (May 2006) is now installed on your machine.

Welcome to the Microsoft .NET LINQ Preview (May 2006).  This is an enhanced version of the LINQ Preview unveiled at PDC 2005. It contains documentation and samples to let you see Language-Integrated Query in action, as well as preliminary IDE support so you can write your own queries.

This release installs a Visual Basic 9.0 compiler, documentation, and sample projects with which you can explore the new feature-set. While the prototype compiler contains feature additions to the Visual Basic language, there remain many features related to LINQ that are not yet implemented. This release builds on January’s CTP, which focused on DLinq in VB and improved editor support for LINQ. This release features improved DLinq support (inheritance, stored procedures, and the new DLinq Designer), support for “Group By” in queries, and LINQ over DataSet.  The features contained in these bits and outlined in the content are only preliminary designs; your feedback is requested!

Check out the LINQ Home Page on MSDN for more samples, videos with the designers of LINQ and the VB language, and forums where you can share and discuss your experiences with the LINQ Project.

What’s new?

Enhanced DLinq Support: This CTP adds support for Inheritance, Stored Procedures, User-Defined Functions, and Optimistic Concurrency Conflict Resolution (OCCR).  The new DLinq Designer provides a visual design surface for creating DLinq entity classes from database tables.

LINQ over DataSet: The full power of LINQ can now be applied to the DataSet, allowing you to use the Standard Query Operators and some DataSet-specific extensions to query against DataRows.

“Group By” Query Comprehensions: The compiler now supports “Group By” as a valid clause in LINQ Queries. 

Outlining support for XML Literals in the Editor: In this release, we added outlining support for XML literals. You can now expand or collapse any Xml element literal that spans across more than one line. 

Value extension property for XML axis properties: We added a Value extension property to the collections that are returned from the XML axis properties (i.e. IEnumerable(Of XElement) and IEnumerable(Of XAttribute)). This extension property does two things, it first picks up the first object in that IEnumerable, and if this object exists, it calls the "Value" property on this object (either XElement or XAttribute). The following code show the use of this Value extension property:

       Dim contact = <Contact City="Seattle">

                         <Name>Joe</Name>

                      </Contact>

        Console.WriteLine(contact.@City.Value)

        contact.@City.Value = "Portland"

        Console.WriteLine(contact.@City.Value)

        Console.WriteLine(contact.<Name>.Value)

        contact.<Name>.Value = "Sam"

        Console.WriteLine(contact.<Name>.Value)

             

        Results:       

                Seattle

                Portland

                Joe

                Sam

Global Xml namespace support: XML namespaces that are declared using the Imports statement can now be used in the XML literals. The following is an example:

Imports ns = "http://www.w3.org/1999"

 

Module Module1

  Sub Main()

    Dim book = _

      <ns:Book>

              <ns:Title>Learning Programming Using VB</ns:Title>

             </ns:Book>

    Console.WriteLine(book.<ns:Title>.Value)

  End Sub

      End Module

What’s changed?

Select/From syntax: The previous tech preview supported using Select before From.  In an effort to provide better IntelliSense™, we’re switching to the From/Select format for this CTP.

Joins don’t require “It”:  You don’t need to use the iterator variable “it” anymore when performing a join operation, though it’s still required for grouping operations.

Xml axis properties syntax: The late bound Xml feature has a new name and a new distinct syntax where we wrap the element name with angle brackets. This new syntax makes the Xml axis properties visually distinct and solves problems that the previous CTP syntax had. See more information in this blog

Prerequisites:

The following are the requirements for the LINQ: Visual Basic Tech Preview:

  • The LINQ: Visual Basic Tech Preview will only run on the 2005 release of Visual Studio and the .NET Framework.  In particular:
    • The prototype VB compiler and the samples below require one of the following:
      • Visual Studio 2005
      • Visual Basic 2005 Express
    • To run DLinq samples, you must have one of the following installed on this machine:
      • SQL Server 2005 Express (included with Visual Studio 2005 or downloadable from http://lab.msdn.microsoft.com/express/sql/default.aspx)
      • The following versions of SQL Server will work, but require some minor code changes to the samples first (see the Troubleshooting section below for instructions): SQL Server 2005 (non-Express) and SQL Server 2000a
  • Windows XP Service Pack 2, Windows 2000 Service Pack 4 or Windows Server 2003 is required.  The LINQ: Visual Basic Tech Preview may not work correctly on 64-bit operating systems.
  • English-language versions of Visual Basic are recommended as the LINQ: Visual Basic Tech Preview has not been tested on other platforms.
  • Please note that the DLinq Designer is not supported in the Express Edition.

Documents:

  • LINQ Project Overview – An explanation of the motivations behind Language-Integrated Query, and a peek into some of the new language capabilities that allow for rich type-checked querying of in-memory data, relational data stores, and XML.
  • Visual Basic 9.0 Overview – A summary of the intrinsic Visual Basic language additions that deeply integrate query capabilities.
  • XLinq Overview – A look at how to use XLinq, a new lightweight XML object model that allows for both Language-Integrated Querying and transformation of XML data.
  • LINQ: Getting Started in Visual Basic 9.0 – An introduction to some of the compiler features that enable LINQ, and tutorials on starting to write your own queries.
  • LINQ Over DataSet for VB Developers – Explains how to use LINQ to query over DataSets, and demonstrates the use of Custom Operators over Datarows.
  • DLinq Overview for Visual Basic – An examination of the architecture of DLinq, which provides type-safe, compiler-checked querying against relational data stores, such as SQL Server.
  • DLinq Hands-On Lab for Visual Basic – Walks through using DLinq to perform Create, Read, Update, and Delete operations against SQL Server.  Also covers code generation using SQLMetal, relationships, transactions, custom queries, and object identity.
  • XLinq Hands-On Lab for Visual Basic – Walks through using XLinq to perform Create, Read, Update, and Delete operations against XML.
  • Walkthrough: Using the DLinq Designer – Shows how use the designer to create DLinq objects and use them for DataBinding in a Windows Form.
  • Standard Query Operators – A description of the Standard Query Operators, the building blocks that are composed to form queries.
  • XLinq Reference – Includes an overview of XLinq, tutorials that teach you how to get started, and an XLinq class library reference.

Samples:

  • Visual Basic 9.0 Survey – Basic samples that serve as a master for the features shipped in this tech preview.
  • Sample Queries – The SampleQueries project contains hundreds of sample Standard Query Operator, DLinq and XLinq queries that you can try out and modify to get a feel for the capabilities of Language-Integrated Query. (Some of the queries require not yet implemented features to enable concise syntax, these queries will be filled out in later CTPs.  Updated with many new samples, including LINQ over DataSet.)
  • Hands on Labs – Self-paced walkthrough which explore overall Language-Integrated Query and deep XML integration in the Visual Basic language.
  • ScanReporter – Demonstrates how to aggregate information from several XML files (contain OS information and security scan results) into an HTML table.
  • SpecConverter – Demonstrates how new features like XML Literals and XML Late binding can be used to transform an unstructured XML document into a new schematized format.
  • XML Dom Survey – A quick introductory application that surveys various approaches on the .NET platform to constructing and reading from XML documents.

Visual Basic IDE Support:

The installer sets up 3 LINQ project templates (LINQ Windows Application, LINQ Console Application, and LINQ Class Library) that you can use to create your own Visual Basic 9.0 projects using LINQ.

IDE Support for Visual Basic 9.0 atop Visual Studio 2005:

Project LINQ relies on several changes to the Visual Basic language. Visual Basic 9.0 contains new keywords and syntax and is not considered valid by the Visual Studio 2005 IDE.  The IDE support included in this build is very much in alpha phase; some keywords may not be colorized correctly, IntelliSense™ may not work in all spots you expect it to, and the syntax error strings may not be descriptive.  When in doubt, refer to the samples and documents shipped with this tech preview.

C# Support:

If you also have C# installed on your machine, the files for the C# Preview are installed. The readme for C# can be found here. The preview files for C# are not installed if you do not have C# installed as a part of Microsoft Visual Studio 2005 or Microsoft C# Express 2005.

Forum:

Join fellow LINQ Preview users for discussions at the LINQ forum

Bloggers:

Several Microsoft bloggers will be talking about the LINQ Project, and specifically VB support for LINQ. The RSS feeds for their blogs will be fed to the MSDN VB Futures site. Check it out regularly for the latest tips and tricks!   http://msdn.microsoft.com/vbasic/future

Also check out the LINQ Home Page on MSDN for more samples, videos with the designers of LINQ and the VB language, and forums where you can share and discuss your experiences with the LINQ Project.

Known Issues and Troubleshooting:

A list of known issues and workarounds where available is on the LINQ home page.

 

 

 

 

 

 

 


Copyright © 2006 Microsoft Corporation.  All rights reserved.