Skip to content

Microsoft.Data.SqlClient #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#### 2.2.0 April 30, 2025

* Using Microsoft.Data.SqlClient
* NET 8.0 compatibility

#### 2.1.3 April 30, 2024

* Issue #440 Toolchain and SDK adjustments, deprecated runtime support for net40
* Contributor: Tuomas Hietanen (https://github.com/Thorium)


#### 2.1.2 May 08, 2022

* Issue #420 fix "TVP Column Ordering is incorrect as of version 2.1.0"
Expand Down
4 changes: 2 additions & 2 deletions TestProjects.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2041
# Visual Studio Version 17
VisualStudioVersion = 17.9.34310.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{E35ED000-5A6C-49E1-82CF-55CB8C16C2AB}"
ProjectSection(SolutionItems) = preProject
Expand Down
2 changes: 1 addition & 1 deletion build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
ReleaseNotes = releaseNotes
Tags = tags
OutputPath = "nuget"
ToolPath = nugetPath
//ToolPath = nugetPath
AccessKey = Fake.Core.Environment.environVarOrDefault "nugetkey" ""
Publish = Fake.Core.Environment.hasEnvironVar "nugetkey"
Dependencies = [] })
Expand All @@ -339,7 +339,7 @@

Target.create "ServeDocs" (fun _ ->
fakeiisexpress.HostStaticWebsite id (__SOURCE_DIRECTORY__ @@ @"docs\output\") |> ignore
fakeiisexpress.OpenUrlInBrowser "http://localhost:8080"

Check warning on line 342 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. This API is obsolete. There is no alternative in FAKE 5 yet. You can help by porting this module.
)

Target.create "ReleaseDocs" (fun _ ->
Expand Down
4 changes: 1 addition & 3 deletions build/paket.references
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
group Build

Fun.Build
Fake.Core.Process
Fake.Core.ReleaseNotes
Expand All @@ -10,10 +9,9 @@ Fake.DotNet.Cli
Fake.DotNet.MSBuild
Fake.DotNet.NuGet
Fake.DotNet.Testing.XUnit2

Fake.Tools.Git
FSharp.Core
FSharp.Formatting
NuGet.CommandLine
System.Data.SqlClient
System.Configuration.ConfigurationManager
System.Configuration.ConfigurationManager
4 changes: 2 additions & 2 deletions docs/content/configuration and Input.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ module DB =
[<Literal>]
let connStr = @"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true"

open System.Data.SqlClient
open Microsoft.Data.SqlClient

type MyCmd1 = SqlCommandProvider<"SELECT 42", connStr>
type MyCmd2 = SqlCommandProvider<"SELECT 42", connStr>
Expand Down Expand Up @@ -291,7 +291,7 @@ type GetBitCoin =

do
let cmd = new DeleteBitCoin(connStr) in cmd.Execute(bitCoinCode) |> ignore
let conn = new System.Data.SqlClient.SqlConnection(connStr)
let conn = new Microsoft.Data.SqlClient.SqlConnection(connStr)
conn.Open()
let tran = conn.BeginTransaction()

Expand Down
8 changes: 4 additions & 4 deletions docs/content/data modification.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ do

currencyRates.Rows.Add newRow
//Insert many more rows here
currencyRates.BulkCopy(copyOptions = System.Data.SqlClient.SqlBulkCopyOptions.TableLock)
currencyRates.BulkCopy(copyOptions = Microsoft.Data.SqlClient.SqlBulkCopyOptions.TableLock)

(**

Expand All @@ -285,13 +285,13 @@ Custom update/bulk copy logic
Both `Update` and `BulkCopy` operations can be configured via parameters, i.e. connection, transaction, batchSize, etc.
That said, default update logic provided by typed DataTable can be insufficient for some advanced scenarios.
You don't need to give up on convenience of static typing, however. You can also
customize update behavior by creating your own instance of [SqlDataAdapter](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.aspx)
(or [SqlBulkCopy](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx)) and configuring it to your needs.
customize update behavior by creating your own instance of [SqlDataAdapter](https://msdn.microsoft.com/en-us/library/Microsoft.Data.SqlClient.sqldataadapter.aspx)
(or [SqlBulkCopy](https://msdn.microsoft.com/en-us/library/Microsoft.Data.SqlClient.sqlbulkcopy.aspx)) and configuring it to your needs.

Pseudocode for custom data adapter:
*)

open System.Data.SqlClient
open Microsoft.Data.SqlClient

do
let currencyRates = new AdventureWorks.Sales.Tables.CurrencyRate()
Expand Down
2 changes: 1 addition & 1 deletion docs/content/faq.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ With a datareader obtained from a custom command you can still reuse the typed r
let getDatesQuery = "SELECT GETDATE() AS Now, GETUTCDATE() AS UtcNow"
type GetDates = SqlCommandProvider<getDatesQuery, connectionString>

open System.Data.SqlClient
open Microsoft.Data.SqlClient
type SqlDataReader with
member this.ToRecords<'T>() =
seq {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/output.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ In later case, resulting `SqlDataReader` can be wrapped into something like that
*)

module SqlDataReader =
open System.Data.SqlClient
open Microsoft.Data.SqlClient
let toMaps (reader: SqlDataReader) =
seq {
use __ = reader
Expand Down
4 changes: 2 additions & 2 deletions docs/content/sqlenumprovider.quickstart.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A typical implementation for overnight orders shipped since Jan 1, 2008 is follo
let connStr = @"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true"

open System
open System.Data.SqlClient
open Microsoft.Data.SqlClient

let conn = new SqlConnection (connStr)
conn.Open()
Expand Down Expand Up @@ -220,7 +220,7 @@ Miscellaneous

### Any ADO.NET supported database
SqlEnumProvider has a static parameter "Provider" which allows to pass ADO.NET provider [invariant name](http://msdn.microsoft.com/en-us/library/h508h681.aspx).
This makes it usable with any ADO.NET supported database. "System.Data.SqlClient" is default value for ADO.NET provider.
This makes it usable with any ADO.NET supported database. "Microsoft.Data.SqlClient" is default value for ADO.NET provider.

Invariant names of available ADO.NET providers can be retrieved as follows:
*)
Expand Down
8 changes: 4 additions & 4 deletions docs/content/transactions.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#r @"..\..\bin\net40\FSharp.Data.SqlClient.dll"
#r @"..\..\bin\net462\FSharp.Data.SqlClient.dll"
#r "System.Transactions"
open FSharp.Data

Expand Down Expand Up @@ -32,7 +32,7 @@ This conforms to familiar [ADO.NET conventions](https://msdn.microsoft.com/en-us
*)

open System
open System.Data.SqlClient
open Microsoft.Data.SqlClient

type CurrencyCode =
SqlEnumProvider<"SELECT Name, CurrencyCode FROM Sales.Currency", connectionString>
Expand Down Expand Up @@ -224,8 +224,8 @@ provided the connections are not open at the same time (which would result in mu

<div class="well well-small" style="margin:0px 70px 0px 20px;">

**TIP** The value of the [Enlist](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.enlist.aspx)
key from [SqlConnection.ConnectionString](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx)
**TIP** The value of the [Enlist](https://msdn.microsoft.com/en-us/library/Microsoft.Data.SqlClient.sqlconnectionstringbuilder.enlist.aspx)
key from [SqlConnection.ConnectionString](https://msdn.microsoft.com/en-us/library/Microsoft.Data.SqlClient.sqlconnection.connectionstring.aspx)
property determines the auto-enlistment behavior of connection instance.
</p></div>

Expand Down
2 changes: 1 addition & 1 deletion docs/content/whatsnew.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Any of these parameters can be ommited.
#r "System.Transactions"

do
use conn = new System.Data.SqlClient.SqlConnection( connectionString)
use conn = new Microsoft.Data.SqlClient.SqlConnection( connectionString)
conn.Open()
use tran = conn.BeginTransaction()
use cmd =
Expand Down
1 change: 0 additions & 1 deletion global.json

This file was deleted.

3 changes: 2 additions & 1 deletion netfx.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</ItemGroup>

<!-- F# SQL CLIENT STUFF -->
<PropertyGroup Condition="$(TargetFramework) == 'net462'">
<PropertyGroup Condition="$(TargetFramework) != 'netstandard2.0'">
<!--
Microsoft.SqlServer.Types is currently not available for netstandard,
USE_SQL_SERVER_TYPES_ASSEMBLY singles out code depending on it
Expand All @@ -46,6 +46,7 @@

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" Condition="'$(TargetFramework)' != 'net462'" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
</ItemGroup>

</Project>
10 changes: 8 additions & 2 deletions nuget/SqlClient.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@
<dependencies>
<group targetFramework="net462">
<dependency id="FSharp.Core" version="8.0.301" />
<dependency id="Microsoft.Data.SqlClient" version="5.2.2" />
<dependency id="Microsoft.Identity.Client" version="4.71" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="FSharp.Core" version="8.0.301" />
<dependency id="System.Data.SqlClient" version="4.9.0" />
<dependency id="System.Configuration.ConfigurationManager" version="9.0.4" />
<dependency id="Microsoft.Data.SqlClient" version="5.2.2" />
<dependency id="System.Configuration.ConfigurationManager" version="8.0.0" />
<dependency id="Microsoft.Identity.Client" version="4.71" />
</group>
<group targetFramework="net8.0">
<dependency id="FSharp.Core" version="8.0.301" />
<dependency id="System.Data.SqlClient" version="4.9.0" />
<dependency id="System.Configuration.ConfigurationManager" version="9.0.4" />
<dependency id="Microsoft.Data.SqlClient" version="5.2.2" />
<dependency id="System.Configuration.ConfigurationManager" version="8.0.0" />
<dependency id="Microsoft.Identity.Client" version="4.71" />
</group>
</dependencies>
</metadata>
Expand Down
34 changes: 23 additions & 11 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ group Build
nuget NuGet.CommandLine
nuget System.Data.SqlClient

nuget System.Configuration.ConfigurationManager
nuget System.Configuration.ConfigurationManager 8.0.0

group Docs
source https://www.nuget.org/api/v2/
Expand All @@ -39,49 +39,59 @@ group Docs

group DesignTime
source https://www.nuget.org/api/v2/
framework: >= net462, >= netstandard20, net8.0
storage: none

nuget System.Configuration.ConfigurationManager 9.0.4
nuget Microsoft.Data.SqlClient 5.2.2
nuget System.Configuration.ConfigurationManager 8.0.0
nuget System.Data.Common
nuget System.Data.SqlClient
nuget System.Runtime.Caching
nuget FSharp.Core 8.0.301
nuget Microsoft.SqlServer.TransactSql.ScriptDom
nuget Microsoft.SqlServer.Types
nuget System.Text.Json
nuget Microsoft.SqlServer.Server

group Test
source https://www.nuget.org/api/v2/

nuget FSharp.Core redirects:force
nuget System.Data.SqlClient
nuget System.Configuration.ConfigurationManager
nuget Microsoft.Data.SqlClient 5.2.2
nuget System.Data.SqlClient
nuget System.Configuration.ConfigurationManager 8.0.0

nuget Microsoft.SqlServer.Types ~> 12
nuget Microsoft.SqlServer.Types
nuget Newtonsoft.Json
nuget xunit = 2.4.1
nuget xunit.runner.visualstudio = 2.4.1
nuget System.Text.Json
nuget Microsoft.SqlServer.Server

group Net40
source https://www.nuget.org/api/v2/
framework: net462
storage: none

nuget FSharp.Core = 8.0.301
nuget Microsoft.Data.SqlClient 5.2.2
nuget System.Configuration.ConfigurationManager 8.0.0
nuget Microsoft.SqlServer.Server
nuget System.Text.Json
nuget System.Data.SqlClient

group TestProjects
source https://www.nuget.org/api/v2/
framework: >= net462, >= netcoreapp2.0, >= netstandard2.0, net8.0
storage: none

nuget FSharp.Core = 8.0.301
nuget Microsoft.Data.SqlClient 5.2.2

nuget System.Data.SqlClient
nuget System.Configuration.ConfigurationManager
nuget System.Configuration.ConfigurationManager 8.0.0
nuget System.Text.Json
nuget Microsoft.SqlServer.Server

group Samples
source https://www.nuget.org/api/v2/
framework: >= net462, >= netcoreapp2.0, >= netstandard2.0, net8.0
redirects: on

nuget FSharp.Core = 8.0.301 redirects: force
Expand All @@ -90,8 +100,10 @@ group Samples
nuget Microsoft.AspNet.WebApi.Client
nuget Microsoft.AspNet.WebApi.Core
nuget Microsoft.AspNet.WebApi.WebHost
nuget System.Data.SqlClient
nuget Microsoft.Data.SqlClient 5.2.2
nuget Microsoft.SqlServer.Types

nuget Newtonsoft.Json redirects: force
nuget FSharp.Data.SqlClient

nuget Microsoft.SqlServer.Server
Loading
Loading