LINQ first emerged at PDC 2005, and though it is intended for the next version of Visual Studio, code-named "Orcas," LINQ is available for use with Visual Studio 2005.
A good starting point for learning more about LINQ is Hooked on LINQ, a wiki for anyone interested in dipping his toe in the water. Among the site's resources are "five-minute overviews" of using LINQ with objects, SQL and XML.
For more on LINQ-to-SQL queries, which were previously called DLINQ queries, check out the Scott Guthrie post Understanding LINQ to SQL Query Translations. (Guthrie is the head of ASP.NET development at Microsoft.) Here you can find hints for working with stored procedures, Where clauses and mathematics functions.
Requires Free Membership to View
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.
Hannah Smalltree, Editorial Director
|
||||
For information on an improvement to LINQ-to-XML queries, also known as XLINQ, Fabrice Marguerie has put together a post called LINQ to XSD -- Typed XML programming with LINQ. XSD in this case refers to an XML schema, which is needed to generate the object models that, in turn, manipulate XML data through LINQ. Using the XML Schema gives developers three benefits, Marguerie said -- better readability, type-checking at compile time and IntelliSense support.
Web developers will be happy to learn that LINQ works quite well with ASP.NET applications. Both the Web Site Project, available out of the box in Visual Studio 2005, and the Web Application Project, included in VS 2005 Service Pack 1, support LINQ development. Guthrie has devoted a few blog posts to the topic; sample code is in C#, but he points out that LINQ works equally well in VB.
- In Using LINQ with ASP.NET (Part 1), he builds an app that binds a collection of objects to a DataGrid and makes uses of Anonymous types and .NET Standard Query Operators. "What is really powerful is that the .NET Standard Query Operators are not a hard-coded list, and can be added to and replaced by any developer. This enables very powerful domain specific implementations," Guthrie writes (emphasis original).
- In Using DLINQ with ASP.NET (Part 2 of my LINQ series), Guthrie dives into database programming with DLINQ and ASP.NET. Here again the Anonymous type is a star, as it allows developers to pull only the desired column values from a database, as opposed to returning fully populated entity objects. In addition, Guthrie points out, LINQ queries can return sub-collections of objects.
- In Building and using a LINQ for SQL Class Library with ASP.NET 2.0, Guthrie creates a Web site that references a LINQ-enabled class library. He also looks into object-relational mapping and how LINQ's debugging visualizer can display what database code is "running under the covers."
Finally, if you want to dive into C# and LINQ, then Charlie Calvert has a series of posts for you. Calvert, a community program manager for Visual C#, has written a six-part series called The LINQ Farm, which takes a look at query expressions, query operators, grouping and other LINQ concepts.
This was first published in February 2007