Skip to content

Commit 23e1999

Browse files
committed
Moved internal methods from SqlEntity under a new interface IColumnHolder
Moved TemplateAsRecord under DesignTimeCommands Better shared caching between same connection contexts.
1 parent 4aa9b86 commit 23e1999

42 files changed

Lines changed: 786 additions & 791 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 1.5.9 - 05.06.2025
2+
* Moved internal methods from SqlEntity under a new interface IColumnHolder.
3+
* ...which is potential breaking change: If you still use them, cast first (entity :> IColumnHolder).GetColumn
4+
* Moved TemplateAsRecord templates under DesignTimeCommands
5+
* Better shared caching between same connection contexts.
6+
17
### 1.5.8 - 04.06.2025
28
* MapTo support Option and ValueOption on target types
39
* TemplateAsRecord to generate list of properies and types

docs/content/core/crud.fsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,12 @@ ctx.SubmitUpdates()
307307
308308
SetColumn takes an object, giving you more control over the type serialization.
309309
310+
### Identifying columns dynamically
311+
310312
*)
313+
314+
let setIfExists (columnName) =
315+
if emp.HasColumn(columnName, StringComparison.InvariantCultureIgnoreCase) then
316+
emp.SetColumn(columnName, "testValue")
317+
318+
(**

docs/content/core/mappers.fsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,6 @@ let mapEmployee (dbRecord:sql.dataContext.``main.EmployeesEntity``) : Employee =
5050

5151
(**
5252
53-
### TemplateAsRecord
54-
55-
If you want to copy and paste the current SQLProvider objects as separate classes, you can use `TemplateAsRecord` property of your database table:
56-
57-
*)
58-
59-
ctx.Main.Employees.TemplateAsRecord
60-
// intellisense will generate you code that you can copy and paste as template to create your own type:
61-
// ``type MainOrders = { CustomerId : String voption; EmployeeId : Int64 voption; Freight : Decimal voption; OrderDate : DateTime voption; OrderId : Int64; RequiredDate : DateTime voption; ShipAddress : String voption; ShipCity : String voption; ShipCountry : String voption; ShipName : String voption; ShipPostalCode : String voption; ShipRegion : String voption; ShippedDate : DateTime voption }``
62-
63-
(**
64-
6553
This could be useful if you e.g. want to use SQLProvider objects in some reflection based code-generator (because the normal objects are erased).
6654
6755
@@ -108,6 +96,22 @@ let qry2 =
10896

10997
(**
11098
99+
### TemplateAsRecord
100+
101+
If you want to use SQLProvider as code-generator and copy and paste the tables as separate classes (not recommended!), you can use `TemplateAsRecord` under your database table type which is located under dataContext types:
102+
103+
*)
104+
105+
sql.dataContext.DesignTimeCommands.TemplateAsRecord.``main.OrdersTemplate``
106+
107+
// intellisense will generate you code that you can copy and paste as template to create your own type:
108+
// ``type MainOrders = { CustomerId : String voption; EmployeeId : Int64 voption; Freight : Decimal voption; OrderDate : DateTime voption; OrderId : Int64; RequiredDate : DateTime voption; ShipAddress : String voption; ShipCity : String voption; ShipCountry : String voption; ShipName : String voption; ShipPostalCode : String voption; ShipRegion : String voption; ShippedDate : DateTime voption }``
109+
110+
(**
111+
112+
The main reason to do this would be to create some reflection schema or MapTo object templates without manual typing.
113+
114+
111115
### ColumnValues
112116
113117
Or alternatively, the ColumnValues from SQLEntity can be used to create a map, with the
@@ -121,3 +125,4 @@ let rows =
121125

122126
let employees2map = rows |> Seq.map(fun i -> i.ColumnValues |> Map.ofSeq)
123127
let firstNames = employees2map |> Seq.map (fun x -> x.["FirstName"])
128+

src/SQLProvider.Common/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ open System.Reflection
55
[<assembly: AssemblyTitleAttribute("SQLProvider.Common")>]
66
[<assembly: AssemblyProductAttribute("SQLProvider")>]
77
[<assembly: AssemblyDescriptionAttribute("Type provider for SQL database access, common library")>]
8-
[<assembly: AssemblyVersionAttribute("1.5.8")>]
9-
[<assembly: AssemblyFileVersionAttribute("1.5.8")>]
8+
[<assembly: AssemblyVersionAttribute("1.5.9")>]
9+
[<assembly: AssemblyFileVersionAttribute("1.5.9")>]
1010
do ()
1111

1212
module internal AssemblyVersionInformation =
1313
let [<Literal>] AssemblyTitle = "SQLProvider.Common"
1414
let [<Literal>] AssemblyProduct = "SQLProvider"
1515
let [<Literal>] AssemblyDescription = "Type provider for SQL database access, common library"
16-
let [<Literal>] AssemblyVersion = "1.5.8"
17-
let [<Literal>] AssemblyFileVersion = "1.5.8"
16+
let [<Literal>] AssemblyVersion = "1.5.9"
17+
let [<Literal>] AssemblyFileVersion = "1.5.9"

0 commit comments

Comments
 (0)