Links: Up
This sample shows how to use F# with LINQ, aka "Microsoft .NET Language-Integrated Queries". This allows you to write language-integrated SQL queries directly in C#, VB and, with this sample, from F#.
The sample comes in two halves. Firstly we define an F# view of (some of) the LINQ functionality, see linq.fs, dlinq.fs and xlinq.fs. We then use this in a sample program based on the sample browser for C# and Visual Basic in the LINQ.
The sample requires .NET 2.0 (Whidbey) and as of F# 1.9.3.0 also requires the Orcas Beta 2 release of LINQ (if you don't want to install Orcas or you need to use this on another machine than just copy out the referenced DLLs from the v3.5 reference assemblies). When the final release of the .NET Framework 3.5 is made a variation on the library portion of this sample is likely to become part of the F# standard library.
LinqToSql is accessed using F# quotations, which are then translated to LINQ Expression trees. The process of translation acts as an advanced sample on F# quotation programming. A simpler sample is found in script.fsx in this directory.