Skip to content

Commit

Permalink
Swap referenced to Microsoft.Data.SqlClient for SqlClient solution
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellittledev committed Feb 26, 2020
1 parent c8148eb commit 9d851b9
Show file tree
Hide file tree
Showing 27 changed files with 1,528 additions and 333 deletions.
2 changes: 1 addition & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Target.create "Build" (fun _ ->
#r "System.IO.Compression"
#r "System.IO.Compression.FileSystem"

open System.Data.SqlClient
open Microsoft.Data.SqlClient
open System.Configuration
open System.IO.Compression

Expand Down
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"

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
4 changes: 2 additions & 2 deletions docs/content/faq.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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 All @@ -123,7 +123,7 @@ type SqlDataReader with
let xs =
use conn = new SqlConnection(connectionString)
conn.Open()
let cmd = new System.Data.SqlClient.SqlCommand(getDatesQuery, conn)
let cmd = new Microsoft.Data.SqlClient.SqlCommand(getDatesQuery, conn)
cmd.ExecuteReader().ToRecords<GetDates.Record>()
|> Seq.toArray

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"

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
6 changes: 3 additions & 3 deletions docs/content/transactions.fsx
Original file line number Diff line number Diff line change
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: 1 addition & 0 deletions netfx.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" Condition="'$(TargetFramework)' != 'net40'" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.1" Condition="'$(TargetFramework)' != 'net40'" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion nuget/SqlClient.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</group>
<group targetFramework="netstandard2.0">
<dependency id="FSharp.Core" version="4.3.4" />
<dependency id="System.Data.SqlClient" version="4.5.1" />
<dependency id="Microsoft.Data.SqlClient" version="4.5.1" />
<dependency id="System.Configuration.ConfigurationManager" version="4.5.0" />
</group>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ group DesignTime

nuget System.Configuration.ConfigurationManager
nuget System.Data.Common
nuget System.Data.SqlClient
nuget Microsoft.Data.SqlClient
nuget System.Runtime.Caching
nuget FSharp.Core
nuget Microsoft.SqlServer.TransactSql.ScriptDom
Expand All @@ -36,7 +36,7 @@ group Test
framework: net461, netcoreapp2.0

nuget FSharp.Core = 4.5.2
nuget System.Data.SqlClient
nuget Microsoft.Data.SqlClient
nuget System.Configuration.ConfigurationManager

nuget Microsoft.SqlServer.Types ~> 12
Expand All @@ -56,7 +56,7 @@ group TestProjects

nuget FSharp.Core = 4.3.4

nuget System.Data.SqlClient
nuget Microsoft.Data.SqlClient
nuget System.Configuration.ConfigurationManager

group Samples
Expand Down
Loading

0 comments on commit 9d851b9

Please sign in to comment.