Last night, I finally dove in and read up on LINQ.
Since I haven’t actually written anything with it, everything I know is just theory and second-hand.
That said, LINQ looks really cool. It’s another example of Microsoft making a complex problem into a simple solution. I love how Microsoft looks at a problem space and says: “I know you say you want … but here’s a solution that addresses your real needs.”
I read a couple of things last night that helped me a lot. First was a Channel9 video with Anders Hejlsberg and Sam Druker from Microsoft.
The second is the MSDN documentation on LINQ for VB.NET. I’d recommend reading the first 3 articles in this section:
- Writing your First LINQ query
(Just read it. Then do your best to hold yourself back from re-writing all your stuff to use LINQ right now!)
- Basic Query Operators
Discusses the operations that you can do with LINQ. Includes things like:
- WHERE clauses
- ORDER BY clauses
- GROUP BY clauses
- JOIN clauses
- VB Features that Support LINQ
This is a great article and explains those terms that have been floating around like Lambda expressions and extension methods. Neither of these are rocket science, but they are key to understanding how LINQ works.
The next steps were looking at the various uses of LINQ. I skimmed some stuff on:
- LINQ to SQL
- Part of .NET 3.5.
- Supports Select, Insert, Update and Delete operations against a database.
- Includes tools to help generate the classes and/or mapping files needed by the LINQ runtime.
- LINQ to Entities and the ADO.NET Entity Framework
- Currently in Beta 3.
- Will be released as an add-on to the .NET 3.5 framework.
- Appears to be database independent. From what I can tell, it will work against SQL 2000, 2005, 2008, Oracle, etc.
- A very powerful mapping technology that puts a powerful abstraction layer between the database schema and the .net code layers. This lets the database change without impacting the code.
Here’s some good articles that discusses the new flavors of data access that MS is offering:
Sorting out LINQ and Entity Framework for Data Access
LINQ to Entities vs. LINQ to SQL
In the past, I’ve read a little about other LINQ features. They are all very compelling and make a lot of sense:
- LINQ to Objects
Lets you write queries against any .NET object or collection.
- LINQ to XML
Sweet! I don’t have to remember XPATH!
LINQ to DataSets
Very logical and powerful feature to have. It’s basically a special case of LINQ to Objects that takes advantage of the capabilities of the DataSet.