@@ -16,27 +16,57 @@ open Microsoft.FSharp.Reflection
1616open System.Collections .Concurrent
1717open System.Runtime .Serialization
1818
19+ /// <summary >
20+ /// Specifies the database provider type for the SQL type provider.
21+ /// Each provider has its own specific implementation for SQL generation and data type mapping.
22+ /// </summary >
1923type DatabaseProviderTypes =
24+ /// Microsoft SQL Server using SqlClient provider
2025 | MSSQLSERVER = 0
26+ /// SQLite database using System.Data.SQLite or Microsoft.Data.Sqlite
2127 | SQLITE = 1
28+ /// PostgreSQL using Npgsql provider
2229 | POSTGRESQL = 2
30+ /// MySQL using MySql.Data or MySqlConnector provider
2331 | MYSQL = 3
32+ /// Oracle Database using Oracle.ManagedDataAccess provider
2433 | ORACLE = 4
34+ /// Microsoft Access using OleDb provider
2535 | MSACCESS = 5
36+ /// Generic ODBC provider for various databases
2637 | ODBC = 6
38+ /// Firebird database using FirebirdSql.Data.FirebirdClient
2739 | FIREBIRD = 7
40+ /// Microsoft SQL Server with dynamic schema loading
2841 | MSSQLSERVER_ DYNAMIC = 8
42+ /// Microsoft SQL Server using SSDT/DacPac for schema
2943 | MSSQLSERVER_ SSDT = 9
44+ /// DuckDB using DuckDB.NET provider
3045 | DUCKDB = 10
46+ /// External/custom database provider
3147 | EXTERNAL = 11
3248
33- type RelationshipDirection = Children = 0 | Parents = 1
49+ /// <summary >Specifies the direction for relationship navigation.</summary >
50+ type RelationshipDirection =
51+ /// Navigate to child records (foreign key relationships)
52+ Children = 0
53+ /// Navigate to parent records (primary key relationships)
54+ | Parents = 1
3455
56+ /// <summary >
57+ /// Specifies how to handle case sensitivity when generating table and column names.
58+ /// </summary >
3559type CaseSensitivityChange =
60+ /// Keep original casing from the database
3661 | ORIGINAL = 0
62+ /// Convert all names to uppercase
3763 | TOUPPER = 1
64+ /// Convert all names to lowercase
3865 | TOLOWER = 2
3966
67+ /// <summary >
68+ /// Specifies how to represent nullable database columns in the generated types.
69+ /// </summary >
4070type NullableColumnType =
4171 /// Nullable types are just Unchecked default. (Old false.)
4272 | NO_ OPTION = 0
@@ -45,7 +75,11 @@ type NullableColumnType =
4575 /// ValueOption is more performant.
4676 | VALUE_ OPTION = 2
4777
78+ /// <summary >
79+ /// Specifies the quote character style for ODBC connections when dealing with table and column names containing spaces or special characters.
80+ /// </summary >
4881type OdbcQuoteCharacter =
82+ /// Use default quoting for the ODBC driver
4983 | DEFAULT_ QUOTE = 0
5084 /// MySQL/Postgre style: ` alias `
5185 | GRAVE_ ACCENT = 1
@@ -58,6 +92,10 @@ type OdbcQuoteCharacter =
5892 /// Single quote: 'alias'
5993 | APHOSTROPHE = 5
6094
95+ /// <summary >
96+ /// Specifies which SQLite library to use for connections.
97+ /// Different libraries may have different capabilities and platform support.
98+ /// </summary >
6199type SQLiteLibrary =
62100 /// .NET Framework default
63101 | SystemDataSQLite = 0
@@ -68,8 +106,16 @@ type SQLiteLibrary =
68106 /// Microsoft.Data.Sqlite. May support .NET Standard 2.0 contract in the future.
69107 | MicrosoftDataSqlite = 3
70108
109+ /// <summary >
110+ /// Contains events for monitoring SQL query execution and debugging.
111+ /// Use these events to log, debug, or analyze the SQL queries generated by the type provider.
112+ /// </summary >
71113module public QueryEvents =
72114
115+ /// <summary >
116+ /// Contains information about a SQL command being executed, including the command text,
117+ /// parameters, and connection information for debugging and monitoring purposes.
118+ /// </summary >
73119 type SqlEventData = {
74120 /// The text of the SQL command being executed.
75121 Command: string
@@ -112,8 +158,18 @@ module public QueryEvents =
112158
113159 let private sqlEvent = Event< SqlEventData>()
114160
115- /// This event fires immediately before the execution of every generated query.
161+ /// <summary >
162+ /// Event that fires immediately before the execution of every generated query.
116163 /// Listen to this event to display or debug the content of your queries.
164+ /// This is useful for logging, performance monitoring, and debugging SQL generation.
165+ /// </summary >
166+ /// <example >
167+ /// <code >
168+ /// QueryEvents.SqlQueryEvent.Add(fun event ->
169+ /// printfn "Executing: %s" event.Command
170+ /// printfn "Parameters: %A" event.Parameters)
171+ /// </code >
172+ /// </example >
117173 [<CLIEvent>]
118174 let SqlQueryEvent = sqlEvent.Publish
119175
@@ -150,13 +206,26 @@ module public QueryEvents =
150206 let internal PublishExpression ( e ) = expressionEvent.Trigger( e)
151207
152208[<Struct>]
209+ /// <summary >
210+ /// Represents the current state of a database entity for change tracking purposes.
211+ /// Used internally by the SQL provider to determine what operations need to be performed during SubmitUpdates().
212+ /// </summary >
153213type EntityState =
214+ /// Entity has not been modified since it was loaded
154215 | Unchanged
216+ /// Entity is new and should be inserted into the database
155217 | Created
218+ /// Entity has been modified; contains list of changed column names
156219 | Modified of string list
220+ /// Entity is marked for deletion (soft delete)
157221 | Delete
222+ /// Entity has been deleted from the database
158223 | Deleted
159224
225+ /// <summary >
226+ /// Specifies how to handle conflicts when inserting records with duplicate primary keys.
227+ /// Currently supported only on databases that have UPSERT capabilities.
228+ /// </summary >
160229[<Struct>]
161230type OnConflict =
162231 /// Throws an exception if the primary key already exists (default behaviour).
@@ -168,18 +237,40 @@ type OnConflict =
168237 /// Currently supported only on PostgreSQL 9.5+
169238 | DoNothing
170239
240+ /// <summary >
241+ /// Attribute for mapping entity properties to database columns with different names.
242+ /// Use this when your database column name differs from your preferred F# property name.
243+ /// </summary >
244+ /// <example >
245+ /// <code >
246+ /// [ < ; MappedColumn("customer_id")> ; ]
247+ /// member x.CustomerId = x.GetColumn< ; int> ; ("customer_id")
248+ /// </code >
249+ /// </example >
171250type MappedColumnAttribute ( name : string ) =
172251 inherit Attribute()
252+ /// Gets the database column name this property maps to
173253 member x.Name with get() = name
174254
255+ /// <summary >Represents a result set as a sequence of rows, where each row is an array of column name-value pairs.</summary >
175256type ResultSet = seq<( string * obj)[]>
257+
258+ /// <summary >Represents different types of result sets that can be returned from stored procedures.</summary >
176259type ReturnSetType =
260+ /// A single scalar value with name and value
177261 | ScalarResultSet of string * obj
262+ /// A result set with name and data rows
178263 | ResultSet of string * ResultSet
264+
265+ /// <summary >Represents different types of return values from stored procedures and functions.</summary >
179266type ReturnValueType =
267+ /// No return value (void)
180268 | Unit
269+ /// A single scalar value
181270 | Scalar of string * obj
271+ /// A single result set
182272 | SingleResultSet of string * ResultSet
273+ /// Multiple result sets
183274 | Set of seq < ReturnSetType >
184275
185276/// Interface to hide internal members that are typically not needed by the user
@@ -478,6 +569,11 @@ type SqlEntity(dc: ISqlDataContext, tableName, columns: ColumnLookup, activeColu
478569 override __.ShouldSerializeValue ( _ ) = false })
479570 |> Seq.cast< PropertyDescriptor> |> Seq.toArray )
480571
572+ /// <summary >
573+ /// The main interface for SQL data context operations. This interface provides all the core functionality
574+ /// for querying, creating, updating, and deleting data through the SQL type provider.
575+ /// Users typically access this through the generated GetDataContext() method.
576+ /// </summary >
481577and ISqlDataContext =
482578 /// Connection string to database
483579 abstract ConnectionString : string
@@ -520,8 +616,12 @@ and ISqlDataContext =
520616 /// Context meant to be read operations only
521617 abstract IsReadOnly : bool
522618
523- /// This is publically exposed and used in the runtime
619+ /// <summary >
620+ /// Interface implemented by generated types that provide access to the underlying data context.
621+ /// This allows access to the ISqlDataContext for advanced operations.
622+ /// </summary >
524623type IWithDataContext =
624+ /// Gets the underlying SQL data context
525625 abstract DataContext : ISqlDataContext
526626
527627/// LinkData is for joins with SelectMany
0 commit comments