Lots of sample queries
This file collects the sample queries from the Visual Studio documentation for F#. The original queries can be found here:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: |
#r "FSharp.Data.TypeProviders.dll" #r "System.Data.dll" #r "System.Data.Linq.dll" #r "FSharp.PowerPack.Linq.dll" #r "FSharpComposableQuery.dll" open System open System.Data.Linq.SqlClient open System.Linq open Microsoft.FSharp.Data.TypeProviders open Microsoft.FSharp.Linq open FSharpComposableQuery |
Query examples
We assume a locally configured SQL Srever database server with the database MyDatabase populated as shown on this page. All of the queries run correctly with FSharpComposableQuery and produce the same answers as the main implementation of F# query. This is because FSharpComposableQuery leaves query operations it doesn't recognize in place.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: |
[<Literal>] let ConnectionString = "Data Source=(localdb)\MyInstance;\ Initial Catalog=MyDatabase; Integrated Security=SSPI" type schema = SqlDataConnection<ConnectionString> let db = schema.GetDataContext() //db.DataContext.Log <- System.Console.Out let student = db.Student let data = [1; 5; 7; 11; 18; 21] type Nullable<'T when 'T : ( new : unit -> 'T) and 'T : struct and 'T :> ValueType > with member this.Print() = if (this.HasValue) then this.Value.ToString() else "NULL" let testQuery f = f query query // Convenience copies of failing tests // Start |
contains query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do select student.Age.Value contains 11 }|> printfn "Is at least one student age 11? %b" |
count query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do select student count } |> printfn "Number of students: %d" |
last query operator.
1: 2: 3: 4: 5: 6: |
query { for s in data do sortBy s last } |> printfn "Last: %d" |
lastOrDefault query operator.
1: 2: 3: 4: 5: 6: |
query { for number in data do sortBy number lastOrDefault } |> printfn "lastOrDefault: %d" |
exactlyOne query operator
1: 2: 3: 4: 5: 6: 7: 8: |
let student2 = query { for student in db.Student do where (student.StudentID = 1) select student exactlyOne } printfn "Student with StudentID = 1 is %s" student2.Name |
exactlyOneOrDefault query operator
1: 2: 3: 4: 5: 6: 7: 8: |
let student3 = query { for student in db.Student do where (student.StudentID = 1) select student exactlyOneOrDefault } printfn "Student with StudentID = 1 is %s" student3.Name |
headOrDefault query operator
1: 2: 3: 4: 5: 6: 7: |
let student4 = query { for student in db.Student do select student headOrDefault } printfn "head student is %s" student4.Name |
select query operator
1: 2: 3: 4: 5: |
query { for (student:schema.ServiceTypes.Student) in db.Student do select student } |> Seq.iter (fun (student:schema.ServiceTypes.Student) -> printfn "StudentID, Name: %d %s" student.StudentID student.Name) |
where query operator
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do where (student.StudentID > 4) select student } |> Seq.iter (fun student -> printfn "StudentID, Name: %d %s" student.StudentID student.Name) |
minBy query operator
1: 2: 3: 4: 5: |
let student5 = query { for student in db.Student do minBy student.StudentID } |
maxBy query operator
1: 2: 3: 4: 5: 6: |
let student6 = query { for student in db.Student do maxBy student.StudentID } |
groupBy query operator.
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do groupBy student.Age into g select (g.Key, g.Count()) } |> Seq.iter (fun (age, count) -> printfn "Age: %s Count at that age: %d" (age.Print()) count) |
sortBy query operator
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do sortBy student.Name select student } |> Seq.iter (fun student -> printfn "StudentID, Name: %d %s" student.StudentID student.Name) |
sortByDescending query operator
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do sortByDescending student.Name select student } |> Seq.iter (fun student -> printfn "StudentID, Name: %d %s" student.StudentID student.Name) |
thenBy query operator
1: 2: 3: 4: 5: 6: 7: 8: |
query { for student in db.Student do where student.Age.HasValue sortBy student.Age.Value thenBy student.Name select student } |> Seq.iter (fun student -> printfn "StudentID, Name: %d %s" student.Age.Value student.Name) |
thenByDescending query operator
1: 2: 3: 4: 5: 6: 7: 8: |
query { for student in db.Student do where student.Age.HasValue sortBy student.Age.Value thenByDescending student.Name select student } |> Seq.iter (fun student -> printfn "StudentID, Name: %d %s" student.Age.Value student.Name) |
groupValBy query operator
1: 2: 3: 4: 5: 6: 7: 8: |
query { for student in db.Student do groupValBy student.Name student.Age into g select (g, g.Key, g.Count()) } |> Seq.iter (fun (group, age, count) -> printfn "Age: %s Count at that age: %d" (age.Print()) count group |> Seq.iter (fun name -> printfn "Name: %s" name)) |
sumByNullable query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do sumByNullable student.Age } |> (fun sum -> printfn "Sum of ages: %s" (sum.Print())) |
minByNullable
1: 2: 3: 4: 5: |
query { for student in db.Student do minByNullable student.Age } |> (fun age -> printfn "Minimum age: %s" (age.Print())) |
maxByNullable
1: 2: 3: 4: 5: |
query { for student in db.Student do maxByNullable student.Age } |> (fun age -> printfn "Maximum age: %s" (age.Print())) |
averageBy
1: 2: 3: 4: 5: |
query { for student in db.Student do averageBy (float student.StudentID) } |> printfn "Average student ID: %f" |
averageByNullable
1: 2: 3: 4: 5: |
query { for student in db.Student do averageByNullable (Nullable.float student.Age) } |> (fun avg -> printfn "Average age: %s" (avg.Print())) |
find query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do find (student.Name = "Abercrombie, Kim") } |> (fun student -> printfn "Found a match with StudentID = %d" student.StudentID) |
all query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do all (SqlMethods.Like(student.Name, "%,%")) } |> printfn "Do all students have a comma in the name? %b" |
head query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do head } |> (fun student -> printfn "Found the head student with StudentID = %d" student.StudentID) |
nth query operator
1: 2: 3: 4: 5: |
query { for numbers in data do nth 3 } |> printfn "Third number is %d" |
skip query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do skip 1 } |> Seq.iter (fun student -> printfn "StudentID = %d" student.StudentID) |
skipWhile query operator
1: 2: 3: 4: 5: 6: |
query { for number in data do skipWhile (number < 3) select number } |> Seq.iter (fun number -> printfn "Number = %d" number) |
sumBy query operator
1: 2: 3: 4: 5: |
query { for student in db.Student do sumBy student.StudentID } |> printfn "Sum of student IDs: %d" |
take query operator
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do select student take 2 } |> Seq.iter (fun student -> printfn "StudentID = %d" student.StudentID) |
takeWhile query operator
1: 2: 3: 4: 5: |
query { for number in data do takeWhile (number < 10) } |> Seq.iter (fun number -> printfn "Number = %d" number) |
sortByNullable query operator
1: 2: 3: 4: 5: 6: 7: |
query { for student in db.Student do sortByNullable student.Age select student } |> Seq.iter (fun student -> printfn "StudentID, Name, Age: %d %s %s" student.StudentID student.Name (student.Age.Print())) |
sortByNullableDescending query operator
1: 2: 3: 4: 5: 6: 7: |
query { for student in db.Student do sortByNullableDescending student.Age select student } |> Seq.iter (fun student -> printfn "StudentID, Name, Age: %d %s %s" student.StudentID student.Name (student.Age.Print())) |
thenByNullable query operator
1: 2: 3: 4: 5: 6: 7: 8: |
query { for student in db.Student do sortBy student.Name thenByNullable student.Age select student } |> Seq.iter (fun student -> printfn "StudentID, Name, Age: %d %s %s" student.StudentID student.Name (student.Age.Print())) |
thenByNullableDescending query operator
1: 2: 3: 4: 5: 6: 7: 8: |
query { for student in db.Student do sortBy student.Name thenByNullableDescending student.Age select student } |> Seq.iter (fun student -> printfn "StudentID, Name, Age: %d %s %s" student.StudentID student.Name (student.Age.Print())) |
All students:
1: 2: 3: 4: 5: |
query { for student in db.Student do select student } |> Seq.iter (fun student -> printfn "%s %d %s" student.Name student.StudentID (student.Age.Print())) |
Count of students:
1: 2: 3: 4: 5: |
query { for student in db.Student do count } |> (fun count -> printfn "Student count: %d" count) |
Exists
1: 2: 3: 4: 5: 6: 7: |
query { for student in db.Student do where (ExtraTopLevelOperators.query { for courseSelection in db.CourseSelection do exists (courseSelection.StudentID = student.StudentID) }) select student } |> Seq.iter (fun student -> printfn "%A" student.Name) |
Group by age and count
1: 2: 3: 4: 5: 6: |
query { for n in db.Student do groupBy n.Age into g select (g.Key, g.Count()) } |> Seq.iter (fun (age, count) -> printfn "%s %d" (age.Print()) count) |
Group value by age
1: 2: 3: 4: 5: 6: 7: 8: 9: |
query { for n in db.Student do groupValBy n.Age n.Age into g select (g.Key, g.Count()) } |> Seq.iter (fun (age, count) -> printfn "%s %d" (age.Print()) count) |
Group students by age where age > 10
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: |
query { for student in db.Student do groupBy student.Age into g where (g.Key.HasValue && g.Key.Value > 10) select (g, g.Key) } |> Seq.iter (fun (students, age) -> printfn "Age: %s" (age.Value.ToString()) students |> Seq.iter (fun student -> printfn "%s" student.Name)) |
Group students by age and print counts of number of students at each age with more than 1 student
1: 2: 3: 4: 5: 6: 7: 8: |
query { for student in db.Student do groupBy student.Age into group where (group.Count() > 1) select (group.Key, group.Count()) } |> Seq.iter (fun (age, ageCount) -> printfn "Age: %s Count: %d" (age.Print()) ageCount) |
Group students by age and sum ages
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: |
query { for student in db.Student do groupBy student.Age into g let total = query { for student in g do sumByNullable student.Age } select (g.Key, g.Count(), total) } |> Seq.iter (fun (age, count, total) -> printfn "Age: %d" (age.GetValueOrDefault()) printfn "Count: %d" count printfn "Total years: %s" (total.ToString())) |
Group students by age and count number of students at each age, and display all with count > 1 in descending order of count
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: |
query { for student in db.Student do groupBy student.Age into g where (g.Count() > 1) sortByDescending (g.Count()) select (g.Key, g.Count()) } |> Seq.iter (fun (age, myCount) -> printfn "Age: %s" (age.Print()) printfn "Count: %d" myCount) |
Select students from a set of IDs
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: |
let idList = [1; 2; 5; 10] let idQuery = query { for id in idList do select id } query { for student in db.Student do where (idQuery.Contains(student.StudentID)) select student } |> Seq.iter (fun student -> printfn "Name: %s" student.Name) |
Look for students with Name match _e%% pattern and take first two
1: 2: 3: 4: 5: 6: 7: |
query { for student in db.Student do where (SqlMethods.Like( student.Name, "_e%") ) select student take 2 } |> Seq.iter (fun student -> printfn "%s" student.Name) |
Look for students with Name matching [abc]%% pattern
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do where (SqlMethods.Like( student.Name, "[abc]%") ) select student } |> Seq.iter (fun student -> printfn "%s" student.Name) |
Look for students with name matching [^abc]%% pattern
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do where (SqlMethods.Like( student.Name, "[^abc]%") ) select student } |> Seq.iter (fun student -> printfn "%s" student.Name) |
Look for students with name matching [^abc]%% pattern and select ID
1: 2: 3: 4: 5: 6: |
query { for n in db.Student do where (SqlMethods.Like( n.Name, "[^abc]%") ) select n.StudentID } |> Seq.iter (fun id -> printfn "%d" id) |
Using Contains as a query filter
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do where (student.Name.Contains("a")) select student } |> Seq.iter (fun student -> printfn "%s" student.Name) |
Searching for names from a list
1: 2: 3: 4: 5: |
let names = [|"a";"b";"c"|] query { for student in db.Student do if names.Contains (student.Name) then select student } |> Seq.iter (fun student -> printfn "%s" student.Name) |
Join Student and CourseSelection tables
1: 2: 3: 4: 5: 6: 7: |
query { for student in db.Student do join selection in db.CourseSelection on (student.StudentID = selection.StudentID) select (student, selection) } |> Seq.iter (fun (student, selection) -> printfn "%d %s %d" student.StudentID student.Name selection.CourseID) |
Left Join Student and CourseSelection tables
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: |
query { for student in db.Student do leftOuterJoin selection in db.CourseSelection on (student.StudentID = selection.StudentID) into result for selection in result.DefaultIfEmpty() do select (student, selection) } |> Seq.iter (fun (student, selection) -> let selectionID, studentID, courseID = match selection with | null -> "NULL", "NULL", "NULL" | sel -> (sel.ID.ToString(), sel.StudentID.ToString(), sel.CourseID.ToString()) printfn "%d %s %d %s %s %s" student.StudentID student.Name (student.Age.GetValueOrDefault()) selectionID studentID courseID) |
Join with count
1: 2: 3: 4: 5: 6: |
query { for n in db.Student do join e in db.CourseSelection on (n.StudentID = e.StudentID) count } |> printfn "%d" |
Join with distinct
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do join selection in db.CourseSelection on (student.StudentID = selection.StudentID) distinct } |> Seq.iter (fun (student, selection) -> printfn "%s %d" student.Name selection.CourseID) |
Join with distinct and count
1: 2: 3: 4: 5: 6: 7: |
query { for n in db.Student do join e in db.CourseSelection on (n.StudentID = e.StudentID) distinct count } |> printfn "%d" |
Selecting students with age between 10 and 15
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do where (student.Age.Value >= 10 && student.Age.Value < 15) select student } |> Seq.iter (fun student -> printfn "%s" student.Name) |
Selecting students with age either 11 or 12
1: 2: 3: 4: 5: 6: |
query { for student in db.Student do where (student.Age.Value = 11 || student.Age.Value = 12) select student } |> Seq.iter (fun student -> printfn "%s" student.Name) |
Selecting students in a certain age range and sorting
1: 2: 3: 4: 5: 6: 7: |
query { for n in db.Student do where (n.Age.Value = 12 || n.Age.Value = 13) sortByNullableDescending n.Age select n } |> Seq.iter (fun student -> printfn "%s %s" student.Name (student.Age.Print())) |
Selecting students with certain ages, taking account of possibility of nulls
1: 2: 3: 4: 5: 6: 7: 8: 9: |
query { for student in db.Student do where ((student.Age.HasValue && student.Age.Value = 11) || (student.Age.HasValue && student.Age.Value = 12)) sortByDescending student.Name select student.Name take 2 } |> Seq.iter (fun name -> printfn "%s" name) |
Union of two queries
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: |
module Queries = let query1 = query { for n in db.Student do select (n.Name, n.Age) } let query2 = query { for n in db.LastStudent do select (n.Name, n.Age) } query2.Union (query1) |> Seq.iter (fun (name, age) -> printfn "%s %s" name (age.Print())) |
Intersect of two queries
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: |
module Queries2 = let query1 = query { for n in db.Student do select (n.Name, n.Age) } let query2 = query { for n in db.LastStudent do select (n.Name, n.Age) } query1.Intersect(query2) |> Seq.iter (fun (name, age) -> printfn "%s %s" name (age.Print())) |
Using if statement to alter results for special value
1: 2: 3: 4: 5: 6: 7: |
query { for student in db.Student do select (if student.Age.HasValue && student.Age.Value = -1 then (student.StudentID, System.Nullable<int>(100), student.Age) else (student.StudentID, student.Age, student.Age)) } |> Seq.iter (fun (id, value, age) -> printfn "%d %s %s" id (value.Print()) (age.Print())) |
Using if statement to alter results special values
1: 2: 3: 4: 5: 6: 7: 8: 9: |
query { for student in db.Student do select (if student.Age.HasValue && student.Age.Value = -1 then (student.StudentID, System.Nullable<int>(100), student.Age) elif student.Age.HasValue && student.Age.Value = 0 then (student.StudentID, System.Nullable<int>(100), student.Age) else (student.StudentID, student.Age, student.Age)) } |> Seq.iter (fun (id, value, age) -> printfn "%d %s %s" id (value.Print()) (age.Print())) |
Multiple table select
1: 2: 3: 4: 5: 6: 7: 8: |
query { for student in db.Student do for course in db.Course do select (student, course) } |> Seq.iteri (fun index (student, course) -> if (index = 0) then printfn "StudentID Name Age CourseID CourseName" printfn "%d %s %s %d %s" student.StudentID student.Name (student.Age.Print()) course.CourseID course.CourseName) |
Multiple Joins
1: 2: 3: 4: 5: 6: 7: 8: 9: |
query { for student in db.Student do join courseSelection in db.CourseSelection on (student.StudentID = courseSelection.StudentID) join course in db.Course on (courseSelection.CourseID = course.CourseID) select (student.Name, course.CourseName) } |> Seq.iter (fun (studentName, courseName) -> printfn "%s %s" studentName courseName) |
Multiple Left Outer Joins
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: |
query { for student in db.Student do leftOuterJoin courseSelection in db.CourseSelection on (student.StudentID = courseSelection.StudentID) into g1 for courseSelection in g1.DefaultIfEmpty() do leftOuterJoin course in db.Course on (courseSelection.CourseID = course.CourseID) into g2 for course in g2.DefaultIfEmpty() do select (student.Name, course.CourseName) } |> Seq.iter (fun (studentName, courseName) -> printfn "%s %s" studentName courseName) |
type LiteralAttribute =
inherit Attribute
new : unit -> LiteralAttribute
Full name: Microsoft.FSharp.Core.LiteralAttribute
--------------------
new : unit -> LiteralAttribute
Full name: QueryExamples.ConnectionString
static member GetDataContext : unit -> MyDatabase + 1 overload
nested type ServiceTypes
Full name: QueryExamples.schema
<summary>Provides the types to access a database, using a LINQ-to-SQL mapping</summary><param name='ConnectionString'>The connection string for the database connection. If using Visual Studio, a connection string can be found in database properties in the Server Explorer window.</param><param name='ConnectionStringName'>The name of the connection string for the database connection in the configuration file.</param><param name='LocalSchemaFile'>The local .dbml file for the database schema (default: no local schema file)</param><param name='ForceUpdate'>Require that a direct connection to the database be available at design-time and force the refresh of the local schema file (default: true)</param><param name='Pluralize'>Automatically pluralize or singularize class and member names using English language rules (default: false)</param><param name='Views'>Extract database views (default: true)</param><param name='Functions'>Extract database functions (default: true)</param><param name='ConfigFile'>The name of the configuration file used for connection strings (default: app.config or web.config is used)</param><param name='DataDirectory'>The name of the data directory, used to replace |DataDirectory| in connection strings (default: the project or script directory)</param><param name='ResolutionFolder'>The folder used to resolve relative file paths at compile-time (default: folder containing the project or script)</param><param name='StoredProcedures'>Extract stored procedures (default: true)</param><param name='Timeout'>Timeout value in seconds to use when SqlMetal accesses the database (default: 0, which means infinite)</param><param name='ContextTypeName'>The name of data context class (default: derived from database name)</param><param name='Serializable'>Generate uni-directional serializable classes (default: false, which means no serialization)</param>
Full name: Microsoft.FSharp.Data.TypeProviders.SqlDataConnection
<summary>Provides the types to access a database, using a LINQ-to-SQL mapping</summary><param name='ConnectionString'>The connection string for the database connection. If using Visual Studio, a connection string can be found in database properties in the Server Explorer window.</param><param name='ConnectionStringName'>The name of the connection string for the database connection in the configuration file.</param><param name='LocalSchemaFile'>The local .dbml file for the database schema (default: no local schema file)</param><param name='ForceUpdate'>Require that a direct connection to the database be available at design-time and force the refresh of the local schema file (default: true)</param><param name='Pluralize'>Automatically pluralize or singularize class and member names using English language rules (default: false)</param><param name='Views'>Extract database views (default: true)</param><param name='Functions'>Extract database functions (default: true)</param><param name='ConfigFile'>The name of the configuration file used for connection strings (default: app.config or web.config is used)</param><param name='DataDirectory'>The name of the data directory, used to replace |DataDirectory| in connection strings (default: the project or script directory)</param><param name='ResolutionFolder'>The folder used to resolve relative file paths at compile-time (default: folder containing the project or script)</param><param name='StoredProcedures'>Extract stored procedures (default: true)</param><param name='Timeout'>Timeout value in seconds to use when SqlMetal accesses the database (default: 0, which means infinite)</param><param name='ContextTypeName'>The name of data context class (default: derived from database name)</param><param name='Serializable'>Generate uni-directional serializable classes (default: false, which means no serialization)</param>
Full name: QueryExamples.db
Get a simplified data context for this SQL connection. By default, no credentials are set
schema.GetDataContext(connectionString: string) : schema.ServiceTypes.SimpleDataContextTypes.MyDatabase
Get a simplified data context for this SQL connection. By default, no credentials are set
Full name: QueryExamples.student
Gets the 'Student' entities from the SQL connection. This property may be used as the source in a query expression.
Full name: QueryExamples.data
type Nullable =
static member Compare<'T> : n1:Nullable<'T> * n2:Nullable<'T> -> int
static member Equals<'T> : n1:Nullable<'T> * n2:Nullable<'T> -> bool
static member GetUnderlyingType : nullableType:Type -> Type
Full name: System.Nullable
--------------------
type Nullable<'T (requires default constructor and value type and 'T :> ValueType)> =
struct
new : value:'T -> Nullable<'T>
member Equals : other:obj -> bool
member GetHashCode : unit -> int
member GetValueOrDefault : unit -> 'T + 1 overload
member HasValue : bool
member ToString : unit -> string
member Value : 'T
end
Full name: System.Nullable<_>
--------------------
Nullable()
Nullable(value: 'T) : unit
Full name: Microsoft.FSharp.Core.unit
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member ToString : unit -> string
Full name: System.ValueType
Full name: QueryExamples.Print
Full name: QueryExamples.testQuery
Full name: FSharpComposableQuery.TopLevelValues.query
Calls QueryBuilder.Select
Calls QueryBuilder.Contains
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
Calls QueryBuilder.Count
Calls QueryBuilder.SortBy
Calls QueryBuilder.Last
Calls QueryBuilder.LastOrDefault
Full name: QueryExamples.student2
Calls QueryBuilder.Where
Calls QueryBuilder.ExactlyOne
Full name: QueryExamples.student3
Calls QueryBuilder.ExactlyOneOrDefault
Full name: QueryExamples.student4
Calls QueryBuilder.HeadOrDefault
nested type Course
nested type CourseSelection
nested type LastStudent
nested type MyDatabase
nested type SimpleDataContextTypes
nested type Student
Full name: QueryExamples.schema.ServiceTypes
<summary><para>The full API to the SQL connection.</para><para>To use the service via the full API, create an instance of one of the types 'MyDatabase'.</para></summary>
interface INotifyPropertyChanging
interface INotifyPropertyChanged
new : unit -> Student
member Age : Nullable<int> with get, set
member CourseSelection : EntitySet<CourseSelection> with get, set
member Name : string with get, set
event PropertyChanged : PropertyChangedEventHandler
event PropertyChanging : PropertyChangingEventHandler
member StudentID : int with get, set
Full name: QueryExamples.schema.ServiceTypes.Student
from Microsoft.FSharp.Collections
Full name: Microsoft.FSharp.Collections.Seq.iter
Full name: QueryExamples.student5
Calls QueryBuilder.MinBy
Full name: QueryExamples.student6
Calls QueryBuilder.MaxBy
Calls QueryBuilder.GroupBy
(extension) Collections.Generic.IEnumerable.Count<'TSource>(predicate: Func<'TSource,bool>) : int
Calls QueryBuilder.SortByDescending
Calls QueryBuilder.ThenBy
Calls QueryBuilder.ThenByDescending
Calls QueryBuilder.GroupValBy
Calls QueryBuilder.SumByNullable
Calls QueryBuilder.MinByNullable
Calls QueryBuilder.MaxByNullable
Calls QueryBuilder.AverageBy
val float : value:'T -> float (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.float
--------------------
type float = Double
Full name: Microsoft.FSharp.Core.float
--------------------
type float<'Measure> = float
Full name: Microsoft.FSharp.Core.float<_>
Calls QueryBuilder.AverageByNullable
Full name: Microsoft.FSharp.Linq.Nullable.float
Calls QueryBuilder.Find
Calls QueryBuilder.All
static member DateDiffDay : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffHour : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffMicrosecond : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffMillisecond : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffMinute : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffMonth : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffNanosecond : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffSecond : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member DateDiffYear : startDate:DateTime * endDate:DateTime -> int + 3 overloads
static member Like : matchExpression:string * pattern:string -> bool + 1 overload
Full name: System.Data.Linq.SqlClient.SqlMethods
SqlMethods.Like(matchExpression: string, pattern: string, escapeCharacter: char) : bool
Calls QueryBuilder.Head
Calls QueryBuilder.Nth
Calls QueryBuilder.Skip
Calls QueryBuilder.SkipWhile
Calls QueryBuilder.SumBy
Calls QueryBuilder.Take
Calls QueryBuilder.TakeWhile
Calls QueryBuilder.SortByNullable
Calls QueryBuilder.SortByNullableDescending
Calls QueryBuilder.ThenByNullable
Calls QueryBuilder.ThenByNullableDescending
from Microsoft.FSharp.Core
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.query
Gets the 'CourseSelection' entities from the SQL connection. This property may be used as the source in a query expression.
Calls QueryBuilder.Exists
Int32.ToString(provider: IFormatProvider) : string
Int32.ToString(format: string) : string
Int32.ToString(format: string, provider: IFormatProvider) : string
Nullable.GetValueOrDefault(defaultValue: int) : int
Full name: QueryExamples.idList
Full name: QueryExamples.idQuery
(extension) Collections.Generic.IEnumerable.Contains<'TSource>(value: 'TSource, comparer: Collections.Generic.IEqualityComparer<'TSource>) : bool
String.Contains(value: string) : bool
(extension) Collections.Generic.IEnumerable.Contains<'TSource>(value: 'TSource, comparer: Collections.Generic.IEqualityComparer<'TSource>) : bool
Full name: QueryExamples.names
Calls QueryBuilder.Join
Calls QueryBuilder.LeftOuterJoin
(extension) Collections.Generic.IEnumerable.DefaultIfEmpty<'TSource>(defaultValue: 'TSource) : Collections.Generic.IEnumerable<'TSource>
Calls QueryBuilder.Distinct
Full name: QueryExamples.Queries.query1
Full name: QueryExamples.Queries.query2
Gets the 'LastStudent' entities from the SQL connection. This property may be used as the source in a query expression.
(extension) IQueryable.Union<'TSource>(source2: Collections.Generic.IEnumerable<'TSource>) : IQueryable<'TSource>
(extension) Collections.Generic.IEnumerable.Union<'TSource>(second: Collections.Generic.IEnumerable<'TSource>, comparer: Collections.Generic.IEqualityComparer<'TSource>) : Collections.Generic.IEnumerable<'TSource>
(extension) IQueryable.Union<'TSource>(source2: Collections.Generic.IEnumerable<'TSource>, comparer: Collections.Generic.IEqualityComparer<'TSource>) : IQueryable<'TSource>
Full name: QueryExamples.Queries2.query1
Full name: QueryExamples.Queries2.query2
(extension) IQueryable.Intersect<'TSource>(source2: Collections.Generic.IEnumerable<'TSource>) : IQueryable<'TSource>
(extension) Collections.Generic.IEnumerable.Intersect<'TSource>(second: Collections.Generic.IEnumerable<'TSource>, comparer: Collections.Generic.IEqualityComparer<'TSource>) : Collections.Generic.IEnumerable<'TSource>
(extension) IQueryable.Intersect<'TSource>(source2: Collections.Generic.IEnumerable<'TSource>, comparer: Collections.Generic.IEqualityComparer<'TSource>) : IQueryable<'TSource>
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
Gets the 'Course' entities from the SQL connection. This property may be used as the source in a query expression.
Full name: Microsoft.FSharp.Collections.Seq.iteri