处理 IN
#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Linq.dll";;
#r @"E:\Projects\F#3\FSharp.Data.TypeProviders.dll";;
open Microsoft.FSharp.Data.TypeProviders;;
open System.Linq;;
//Contains 在其中
[<Generate>]
type T0 = SqlDataConnection<"Data Source=.\SQLEXPRESS;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234">
let TypeProvider2 () =
let db = T0.GetDataContext();
let q = query {
for n in db.Course do
join (for e in db.CourseSelection -> n.CourseID = e.CourseID.Value)
select (n.CourseName, e.StudentID)
}
let names = [|"Lisa"; "Brent"; "Jimmy"|]
let q1 = query {
for n in db.Student do
if names.Contains (n.Name) then select n
}
q1 |> Seq.iter (fun n -> printfn "%A" n.Name)