Tuesday, July 29, 2008

LINQ - Level 100

I've been talking about LINQ recently and the more I learn, the more I write as I think it is a well cool technology that I like talking about :) But if you're starting out and not sure how to start using LINQ what do you do?

This post is level 100 so very high level and it is meant to give newcomers an overview on how to start with LINQ, ie what tools you need what version of Visual Studio, language versions supported platforms, what's supported on devices and finally some links to get started.

Visual Studio 2008

You will need to use the new language features only available in C# 3.0 and VB 9.0 which can be used with Visual Studio 2008. I have shown code examples in C# but the concepts are the same for VB.

So you'll need at least Visual Studio 2008 and target 3.5 of the framework.

Types of LINQ (all supported on the desktop)

  1. LINQ to SQL (old name DLINQ)
  2. LINQ to XML
  3. LINQ to DataSets
  4. LINQ to Entities (sometimes called LINQ to ADO.NET)
  5. LINQ to Objects
One requirement to using LINQ to Entities which is a superset of LINQ to SQL is Visual Studio 2008 SP1 beta. VS SP1 beta adds the Entity Framework support to Visual Studio. Another nice feature worth mentioning and slightly related to LINQ, is support for SQL Server 2008 via Server Explorer - which is neat.

Types of LINQ supported on the Compact Framework (v 3.5)

  1. LINQ to DataSets
  2. LINQ to Xml
  3. LINQ to Objects
Sadly no LINQ to SQL/Entities is supported as yet and there haven't been any announcements when and if it will be supported.

You can use SQL Metal to generate the .dbml file for LINQ to SQL - but this will only work for SQL Compact on the desktop not device.

Some good resources (not device specific though) can be found at:

http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx

LINQ in Action: http://linqinaction.net/

Mike Taulty: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1001.aspx

No comments: