This project is read-only.
DBML Provider - Console.Out as output

Description: Use Console.Out to log the underlying query. You can download the SQL server 2008 Express version for free. Please refer to CreateFSharpSampleDatabase.sql or run Setup project to configure your database.

type T1 = Microsoft.FSharp.Data.TypeProviders.DbmlFile< @".\Support.DataClasses.dbml" >
let typeDBMLProvider2() =
let db = new T1.DataClasses1DataContext("Data Source=localhost;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234")
db.Log <- Console.Out
let q = query {
for n in db.Students do
select n.Name }
q |> Seq.iter (fun n -> printfn "student name = %s" n)

Execution Result:
SELECT [t0].[Name]
FROM [dbo].[Student] AS [t0]
-- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build: 4.0.30319.17281

student name = Lisa
student name = Brent
student name = Anita
student name = Ken
student name = Cathy
student name = Tom
student name = Zeoy
student name = Mark
student name = John

Last edited Mar 1, 2012 at 8:09 PM by ttliu2000, version 2


No comments yet.