Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 1.5.35 - 22.11.2026
- A query's row reader is compiled once per shape and reused when the query runs again, with any captured values: a run no longer compiles and JITs a new delegate. Unchanged where the runtime interprets lambdas (IsDynamicCodeSupported false)
- Values a query reads once (a captured variable's member, a sub-query's source, a method call on captured values) are read by reflection, and other one-off expressions are interpreted where the runtime can (not on .NET Framework), instead of compiled
- An exception thrown while evaluating a query's captured value is raised as it is, not wrapped in TargetInvocationException

### 1.5.34 - 21.11.2026
- Offline mode (ContextSchemaPath) saves three files beside each other: schema.json for the schema, schema.descriptions.json for table and column descriptions (comments), schema.individuals.json for individuals. Builds read only the schema file; the descriptions file is read for the first tooltip and the individuals file when Individuals are first opened
- Offline tooltips show the saved table and column descriptions, instead of only "Offline mode." SaveContextSchema saves the descriptions of what you hovered over online
Expand Down
4 changes: 2 additions & 2 deletions docs/content/core/composable.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ open System.Linq
let nestedQueryTest =
let qry1 = query {
for emp in ctx.Main.Employees do
where (emp.FirstName.StartsWith("S"))
where (emp.FirstName.StartsWith "S")
select emp.FirstName
}
query {
for emp in ctx.Main.Employees do
where (qry1.Contains(emp.FirstName))
where (qry1.Contains emp.FirstName)
select (emp.FirstName, emp.LastName)
} |> Seq.toArray

Expand Down
4 changes: 2 additions & 2 deletions docs/content/core/crud.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ row.CustomerId <- customer.CustomerId
row.EmployeeId <- employee.EmployeeId
row.Freight <- 10M
row.OrderDate <- now.AddDays(-1.0)
row.RequiredDate <- now.AddDays(1.0)
row.RequiredDate <- now.AddDays 1.0
row.ShipAddress <- "10 Downing St"
row.ShipCity <- "London"
row.ShipName <- "Dragons den"
Expand Down Expand Up @@ -188,7 +188,7 @@ output of .ColumnValues:

employees
|> Seq.map (fun x ->
ctx.Main.Employees.Create(x.ColumnValues)) // create twins
ctx.Main.Employees.Create x.ColumnValues) // create twins
|> Seq.toList

/// Retrieve the FSharp.Data.Sql.Common.SqlEntity objects
Expand Down
2 changes: 1 addition & 1 deletion docs/content/core/locking.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ let saveFreight (orderId: int64) (freightSeen: decimal) (newFreight: decimal) =
use scope =
new TransactionScope(
TransactionScopeOption.Required,
TransactionOptions(IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted),
TransactionOptions(IsolationLevel = IsolationLevel.ReadCommitted),
TransactionScopeAsyncFlowOption.Enabled)

let ctx = sql.GetDataContext()
Expand Down
2 changes: 2 additions & 0 deletions docs/content/core/querying.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ let xs2 =

*)
// query parameters:
[<Literal>]
let allCountries = false // or true
[<Literal>]
let onlyCountry = "Finland" // or ""

query { for c in ctx.Main.Customers do
Expand Down
18 changes: 18 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project>
<!-- The compiler loads a type provider's design-time assemblies into its own process, where FSharp.Core is the
compiler's own: an assembly built against a newer FSharp.Core doesn't load there. The .NET 8 and 9 SDK
compilers load the net8.0 design-time, so what goes into that folder (a design-time project and Common) is
built against FSharp.Core 8 on net8.0. Every other framework, and the runtime projects on net8.0 too, keep
the FSharp.Core of paket.dependencies. -->
<PropertyGroup>
<DesignTimeFSharpCoreVersion>8.0.403</DesignTimeFSharpCoreVersion>
<UseDesignTimeFSharpCore Condition="'$(TargetFramework)' == 'net8.0' And ('$(MSBuildProjectName)' == 'SQLProvider.Common' Or $(MSBuildProjectName.EndsWith('.DesignTime')))">true</UseDesignTimeFSharpCore>
</PropertyGroup>
<!-- Paket adds its PackageReference items in the PaketRestore target, so FSharp.Core is replaced after it -->
<Target Name="UseDesignTimeFSharpCore" AfterTargets="PaketRestore" BeforeTargets="CollectPackageReferences" Condition="'$(UseDesignTimeFSharpCore)' == 'true'">
<ItemGroup>
<PackageReference Remove="FSharp.Core" />
<PackageReference Include="FSharp.Core" Version="$(DesignTimeFSharpCoreVersion)" />
</ItemGroup>
</Target>
</Project>
8 changes: 4 additions & 4 deletions src/SQLProvider.Common/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("SQLProvider.Common")>]
[<assembly: AssemblyProductAttribute("SQLProvider")>]
[<assembly: AssemblyDescriptionAttribute("Type provider for SQL database access, common library")>]
[<assembly: AssemblyVersionAttribute("1.5.34")>]
[<assembly: AssemblyFileVersionAttribute("1.5.34")>]
[<assembly: AssemblyVersionAttribute("1.5.35")>]
[<assembly: AssemblyFileVersionAttribute("1.5.35")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "SQLProvider.Common"
let [<Literal>] AssemblyProduct = "SQLProvider"
let [<Literal>] AssemblyDescription = "Type provider for SQL database access, common library"
let [<Literal>] AssemblyVersion = "1.5.34"
let [<Literal>] AssemblyFileVersion = "1.5.34"
let [<Literal>] AssemblyVersion = "1.5.35"
let [<Literal>] AssemblyFileVersion = "1.5.35"
14 changes: 9 additions & 5 deletions src/SQLProvider.Common/SqlRuntime.Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ and SchemaCache =
use ms = new MemoryStream(Encoding.UTF8.GetBytes(File.ReadAllText(filePath)))
let ser = System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof<SchemaCache>)
// Schema files saved before 1.5.34 may carry individuals in the schema file itself: they're kept.
let loaded = ser.ReadObject(ms) :?> SchemaCache
let loaded = ser.ReadObject ms :?> SchemaCache
let cache =
{ loaded with
IsOffline = true
Expand Down Expand Up @@ -995,7 +995,7 @@ and SchemaCache =
File.WriteAllText(filePath, Encoding.UTF8.GetString(json, 0, json.Length))
static member private ReadJson<'T>(filePath) =
use ms = new MemoryStream(Encoding.UTF8.GetBytes(File.ReadAllText filePath))
System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof<'T>).ReadObject(ms) :?> 'T
System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof<'T>).ReadObject ms :?> 'T
/// Saves the schema, and the descriptions and the individuals read so far to their own files. Individuals are
/// not in the schema file, and each table is in the individuals file once: see SaveIndividuals.
member this.Save(filePath) =
Expand Down Expand Up @@ -1056,7 +1056,11 @@ and SchemaCache =
// The offset is that of the machine that saved the file. With it the date is as the database gave it,
// whatever the time zone of the machine that reads the file.
let offset = m.Groups.[2].Value
#if NETSTANDARD21
let minutes = Int32.Parse(offset.AsSpan(1, 2)) * 60 + Int32.Parse(offset.AsSpan(3, 2))
#else
let minutes = Int32.Parse(offset.Substring(1, 2)) * 60 + Int32.Parse(offset.Substring(3, 2))
#endif
let saved = utc.AddMinutes(float (if offset.[0] = '-' then -minutes else minutes))
Some (DateTime.SpecifyKind(saved, DateTimeKind.Unspecified))
/// A primary key value read from a file, as the design time has it online: in the type of its column. The file
Expand Down Expand Up @@ -1103,7 +1107,7 @@ and SchemaCache =
let keys = [ table.FullName; tableKey; table.Name ]
match SchemaCache.TryFindKeyed(this.PrimaryKeys, keys), SchemaCache.TryFindKeyed(this.Columns, keys) with
| Some [ pk ], Some columns ->
let key = table.FullName + "_" + pk
let key = $"{table.FullName}_{pk}"
match this.Individuals.TryGetValue key, columns.TryFind pk with
| (true, entities), Some column when not (isNull entities) ->
let clrType = try Utilities.getType column.TypeMapping.ClrType with _ -> null
Expand Down Expand Up @@ -1350,12 +1354,12 @@ module CommonTasks =
|> List.choose (fun (_, key) ->
match key with
| KeyColumn name -> Some(name.ToUpperInvariant())
| _ -> None)
| CanonicalOperation _ | GroupColumn _ -> None)
|> Set.ofList
let alias =
Seq.initInfinite (fun extra -> sprintf "sqlp_key%i%s" index (String.replicate extra "_"))
|> Seq.find (fun name -> not (taken.Contains(name.ToUpperInvariant())))
sprintf "%s as %s" notation alias
$"%s{notation} as %s{alias}"
| _ -> plain

/// The select list of a grouped query: the key columns (`keys`, in the order of the groupings' Keys) of each
Expand Down
Loading
Loading