Skip to content

Commit 84c6f1e

Browse files
committed
move to Microsoft.Data.SqlClient, ubuntu focus
1 parent ffb6fc5 commit 84c6f1e

17 files changed

Lines changed: 72 additions & 46 deletions

File tree

build/build.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ Target.create "RunTests" (fun _ ->
281281
let dnTestOptions framework (args: DotNet.TestOptions) =
282282
{ args with
283283
Framework = Some framework
284+
Configuration = DotNet.Release
284285
Common = args.Common
285286
NoBuild = true
286287
MSBuildParams =

paket.dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ group DesignTime
4242
framework: >= netstandard20, net9.0
4343
storage: none
4444

45-
nuget System.Configuration.ConfigurationManager 9.0.4
45+
nuget System.Configuration.ConfigurationManager 9.0.11
4646
nuget System.Data.Common
4747
nuget Microsoft.Data.SqlClient
4848
nuget System.Runtime.Caching

paket.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,9 @@ NUGET
573573
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos))
574574
System.Runtime (>= 4.3) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos))
575575
System.ComponentModel.Annotations (5.0) - restriction: || (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (&& (< net8.0) (>= netstandard2.1))
576-
System.Configuration.ConfigurationManager (9.0.4)
577-
System.Diagnostics.EventLog (>= 9.0.4) - restriction: >= net8.0
578-
System.Security.Cryptography.ProtectedData (>= 9.0.4) - restriction: || (&& (< net462) (>= netstandard2.0)) (>= net8.0)
576+
System.Configuration.ConfigurationManager (9.0.11)
577+
System.Diagnostics.EventLog (>= 9.0.11) - restriction: >= net8.0
578+
System.Security.Cryptography.ProtectedData (>= 9.0.11) - restriction: || (&& (< net462) (>= netstandard2.0)) (>= net8.0)
579579
System.Data.Common (4.3)
580580
System.Collections (>= 4.3) - restriction: && (< monoandroid) (< net451) (>= netstandard2.0) (< win81) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)
581581
System.Globalization (>= 4.3) - restriction: && (< monoandroid) (< net451) (>= netstandard2.0) (< win81) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)

src/SqlClient.DesignTime/SqlClient.DesignTime.fsproj

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<WarningsNotAsErrors>$(WarningsNotAsErrors);FS0026;FS3218;FS3548</WarningsNotAsErrors>
2020
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
2121
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
22-
<DefineConstants>$(DefineConstants);DESIGNTIME_CODE_ONLY;IS_DESIGNTIME;WITH_LEGACY_NAMESPACE</DefineConstants>
22+
<DefineConstants>$(DefineConstants);DESIGNTIME_CODE_ONLY;IS_DESIGNTIME;WITH_LEGACY_NAMESPACE;USE_SYSTEM_DATA_COMMON_DBPROVIDERFACTORIES</DefineConstants>
2323
</PropertyGroup>
2424
<ItemGroup>
2525
<!--
@@ -74,7 +74,31 @@
7474
<None Include="Scripts\ReverseLineOrderForNotex.fsx" />
7575
<None Include="Scripts\XE.fsx" />
7676
</ItemGroup>
77+
<!--
78+
Type providers execute at compile-time, so the design-time output folder must
79+
contain real implementation assemblies, not the portable/reference "bait" stubs.
80+
Microsoft.Data.SqlClient (and a few others) ship bait-and-switch: the lib/net9.0
81+
assembly throws PlatformNotSupportedException; the real code lives under
82+
runtimes/{rid}/lib/net9.0/. After build, overwrite the bait with the correct
83+
RID-specific implementation so the TP host can actually open SQL connections.
84+
-->
7785
<Target Name="CopyAssembliesToTPFolder" AfterTargets="Build">
86+
<PropertyGroup>
87+
<_TPRid Condition="$([MSBuild]::IsOSPlatform('Linux'))">unix</_TPRid>
88+
<_TPRid Condition="$([MSBuild]::IsOSPlatform('OSX'))">unix</_TPRid>
89+
<_TPRid Condition="$([MSBuild]::IsOSPlatform('Windows'))">win</_TPRid>
90+
<_TPOutputDir>$(TargetDir)</_TPOutputDir>
91+
<_TPRuntimeDir>$(_TPOutputDir)runtimes/$(_TPRid)/lib/$(TargetFramework)</_TPRuntimeDir>
92+
</PropertyGroup>
93+
<ItemGroup>
94+
<_RidSpecificAssemblies Include="$(_TPRuntimeDir)/*.dll" />
95+
</ItemGroup>
96+
<Message Importance="high" Text="TP RID copy: $(_TPRuntimeDir) -> $(_TPOutputDir)" />
97+
<Copy SourceFiles="@(_RidSpecificAssemblies)"
98+
DestinationFolder="$(_TPOutputDir)"
99+
OverwriteReadOnlyFiles="true"
100+
SkipUnchangedFiles="false"
101+
Condition="Exists('$(_TPRuntimeDir)')" />
78102
</Target>
79103
<Import Project="..\..\.paket\Paket.Restore.targets" />
80104
</Project>

src/SqlClient.DesignTime/SqlEnumProvider.fs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ type SqlEnumProvider(config: TypeProviderConfig) as this =
123123
| Literal value -> value, provider
124124
| NameInConfig(_, value, provider) -> value, provider
125125

126-
#if !USE_SYSTEM_DATA_COMMON_DBPROVIDERFACTORIES
127-
// not supported on netstandard 20?
128-
raise ("DbProviderFactories not available" |> NotImplementedException)
129-
#else
126+
#if USE_SYSTEM_DATA_COMMON_DBPROVIDERFACTORIES
127+
if not (DbProviderFactories.GetProviderInvariantNames() |> Seq.contains providerName) then
128+
DbProviderFactories.RegisterFactory(providerName, Microsoft.Data.SqlClient.SqlClientFactory.Instance)
129+
130+
#endif
130131
let adoObjectsFactory = DbProviderFactories.GetFactory(providerName: string)
131132
use conn = adoObjectsFactory.CreateConnection()
132133
conn.ConnectionString <- connStr
@@ -352,8 +353,6 @@ type SqlEnumProvider(config: TypeProviderConfig) as this =
352353
tempAssembly.AddTypes [ providedEnumType ]
353354
providedEnumType
354355

355-
#endif
356-
357356
//Quotation factories
358357

359358
static member internal GetTryParseImpl<'Value> items =

src/SqlClient.Samples/ConsoleSample/Program.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ open FSharp.Data
55

66
[<Literal>]
77
let ConnStr =
8-
"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true"
8+
"Data Source=localhost,1433;Initial Catalog=AdventureWorks2012;User ID=SA;Password=YourStrong@Passw0rd;TrustServerCertificate=true"
99

1010
// ── SqlCommandProvider ──────────────────────────────────────────────────────
1111
// Typed query: top N products with SellStartDate after the given date.

src/SqlClient.Samples/ConsoleSample/app.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<configuration>
33
<connectionStrings>
44
<add name="AdventureWorks"
5-
connectionString="Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true" />
5+
connectionString="Data Source=localhost,1433;Initial Catalog=AdventureWorks2012;User ID=SA;Password=YourStrong@Passw0rd;TrustServerCertificate=true" />
66
</connectionStrings>
77
</configuration>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<connectionStrings>
4-
<add name="AdventureWorks" connectionString="Data Source=localhost;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true" />
4+
<add name="AdventureWorks" connectionString="Data Source=localhost,1433;Initial Catalog=AdventureWorks2012;User ID=SA;Password=YourStrong@Passw0rd;TrustServerCertificate=true" />
55
</connectionStrings>
66
</configuration>

src/SqlClient.TestProjects/SqlClient.Tests.NetCoreApp/Program.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ open FSharp.Data
33

44
[<Literal>]
55
let Cnx =
6-
"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true"
6+
"Data Source=localhost,1433;Initial Catalog=AdventureWorks2012;User ID=SA;Password=YourStrong@Passw0rd;TrustServerCertificate=true"
77

88
type SingleColumnSelect = SqlEnumProvider<"SELECT Name FROM Purchasing.ShipMethod", Cnx>
99

src/SqlClient/SqlClient.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</PropertyGroup>
1818
<ItemGroup>
1919
<PackageReference Include="FSharp.Core" Version="8.0.301" />
20-
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.4" />
21-
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
20+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.11" />
21+
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.4" />
2222
</ItemGroup>
2323
<ItemGroup>
2424
<Compile Include="AssemblyInfo.fs" />

0 commit comments

Comments
 (0)