Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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
88 changes: 88 additions & 0 deletions MicrosoftSqlClient.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.2.11415.280
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{FD7933BD-2A90-49EB-A4B2-95F9D3076BBD}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{7ECDF2A7-A71C-43B5-AFF2-64468098B7B6}"
ProjectSection(SolutionItems) = preProject
nuget\SqlClient.nuspec = nuget\SqlClient.nuspec
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9E58B00A-A993-4542-B40F-C58AC1A9AA4D}"
ProjectSection(SolutionItems) = preProject
build.cmd = build.cmd
build.fsx = build.fsx
Directory.Build.props = Directory.Build.props
fsc.props = fsc.props
LICENSE.md = LICENSE.md
netfx.props = netfx.props
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{61AC061E-5824-41B7-8E09-8D3A73D564E5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{4B60BF24-D078-4950-A994-A633FBC272EB}"
ProjectSection(SolutionItems) = preProject
docs\content\comparison.fsx = docs\content\comparison.fsx
docs\content\configuration and input.fsx = docs\content\configuration and input.fsx
docs\content\data modification.fsx = docs\content\data modification.fsx
docs\content\debugging.fsx = docs\content\debugging.fsx
docs\content\faq.fsx = docs\content\faq.fsx
docs\content\index.fsx = docs\content\index.fsx
docs\content\netcore.md = docs\content\netcore.md
docs\content\output.fsx = docs\content\output.fsx
docs\content\setup.fsx = docs\content\setup.fsx
docs\content\SqlClientComparison.md = docs\content\SqlClientComparison.md
docs\content\sqlenumprovider.quickstart.fsx = docs\content\sqlenumprovider.quickstart.fsx
docs\content\transactions.fsx = docs\content\transactions.fsx
docs\content\unit-testing.fsx = docs\content\unit-testing.fsx
docs\content\whatsnew.fsx = docs\content\whatsnew.fsx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{573DBBFB-0F97-4327-8614-6A4151CD70BF}"
ProjectSection(SolutionItems) = preProject
docs\tools\generate.fsx = docs\tools\generate.fsx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{CB79269B-025B-4D6A-AF84-0AD821F6A602}"
ProjectSection(SolutionItems) = preProject
docs\tools\templates\template.cshtml = docs\tools\templates\template.cshtml
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MicrosoftSqlClient", "src\SqlClient\MicrosoftSqlClient.fsproj", "{EC8B6AB2-A73B-7E89-8114-D2A8BF40B7AD}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MicrosoftSqlClient.DesignTime", "src\SqlClient.DesignTime\MicrosoftSqlClient.DesignTime.fsproj", "{4E5E48E3-C8C0-7AB6-C191-CA189FFA4C79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EC8B6AB2-A73B-7E89-8114-D2A8BF40B7AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC8B6AB2-A73B-7E89-8114-D2A8BF40B7AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC8B6AB2-A73B-7E89-8114-D2A8BF40B7AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC8B6AB2-A73B-7E89-8114-D2A8BF40B7AD}.Release|Any CPU.Build.0 = Release|Any CPU
{4E5E48E3-C8C0-7AB6-C191-CA189FFA4C79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E5E48E3-C8C0-7AB6-C191-CA189FFA4C79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E5E48E3-C8C0-7AB6-C191-CA189FFA4C79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E5E48E3-C8C0-7AB6-C191-CA189FFA4C79}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4B60BF24-D078-4950-A994-A633FBC272EB} = {61AC061E-5824-41B7-8E09-8D3A73D564E5}
{573DBBFB-0F97-4327-8614-6A4151CD70BF} = {61AC061E-5824-41B7-8E09-8D3A73D564E5}
{CB79269B-025B-4D6A-AF84-0AD821F6A602} = {573DBBFB-0F97-4327-8614-6A4151CD70BF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {82096CC6-31F2-47A5-8D46-E41C63B4DB58}
EndGlobalSection
EndGlobal
50 changes: 50 additions & 0 deletions MicrosoftTests.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.2.11415.280
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{E35ED000-5A6C-49E1-82CF-55CB8C16C2AB}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
paket.lock = paket.lock
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution items", "{0005CBDB-E976-46EE-89A0-CEE3F25A9365}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
fsc.props = fsc.props
netfx.props = netfx.props
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MicrosoftSqlClient.Tests", "tests\SqlClient.Tests\MicrosoftSqlClient.Tests.fsproj", "{46E56CE8-D338-60A6-F874-AFD549D076C0}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MicrosoftSqlClient.DesignTime.Tests", "tests\SqlClient.DesignTime.Tests\MicrosoftSqlClient.DesignTime.Tests.fsproj", "{E7BC3763-8176-B9DB-0B4E-47E24C255A13}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MicrosoftSqlClient.SqlServerTypes.Tests", "tests\SqlClient.SqlServerTypes.Tests\MicrosoftSqlClient.SqlServerTypes.Tests.fsproj", "{36FAFB63-20F6-A6F9-55D8-90795B3641AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{46E56CE8-D338-60A6-F874-AFD549D076C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46E56CE8-D338-60A6-F874-AFD549D076C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46E56CE8-D338-60A6-F874-AFD549D076C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46E56CE8-D338-60A6-F874-AFD549D076C0}.Release|Any CPU.Build.0 = Release|Any CPU
{E7BC3763-8176-B9DB-0B4E-47E24C255A13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7BC3763-8176-B9DB-0B4E-47E24C255A13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7BC3763-8176-B9DB-0B4E-47E24C255A13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7BC3763-8176-B9DB-0B4E-47E24C255A13}.Release|Any CPU.Build.0 = Release|Any CPU
{36FAFB63-20F6-A6F9-55D8-90795B3641AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36FAFB63-20F6-A6F9-55D8-90795B3641AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36FAFB63-20F6-A6F9-55D8-90795B3641AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36FAFB63-20F6-A6F9-55D8-90795B3641AE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB177D8C-41D5-430D-94E8-485567A72F92}
EndGlobalSection
EndGlobal
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#### 2.9.99-alpha April 30, 2024

* Issue #482 Support for Microsoft.Data.SqlClient in FSharp.Data.MicrosoftSqlClient package
* Contributor: Daniel Little (https://github.com/daniellittledev), Gauthier Segay (https://github.com/smoothdeveloper)

#### 2.1.3 April 30, 2024

* Issue #440 Toolchain and SDK adjustments, deprecated runtime support for net40
Expand Down
140 changes: 91 additions & 49 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,33 @@
Excludes = [] }

// Information about the project to be used at NuGet and in AssemblyInfo files
let project = "FSharp.Data.SqlClient"
let designTimeProject = "FSharp.Data.SqlClient.DesignTime"
let systemSqlProject = {|
runtime = "FSharp.Data.SqlClient"
designTime = "FSharp.Data.SqlClient.DesignTime"
slnPath = makeRootPath "SqlClient.sln"
testProjectsSlnPath = makeRootPath "TestProjects.sln"
testSlnPath = makeRootPath "Tests.sln"
testProjectPath = makeRootPath "tests/SqlClient.Tests/SqlClient.Tests.fsproj"
nugetSpec = "nuget/SqlClient.nuspec"
|}
let microsoftSqlProject = {|
runtime = "FSharp.Data.MicrosoftSqlClient"
designTime = "FSharp.Data.MicrosoftSqlClient.DesignTime"
slnPath = makeRootPath "MicrosoftSqlClient.sln"
testProjectsSlnPath = makeRootPath "MicrosoftTestProjects.sln"
testSlnPath = makeRootPath "MicrosoftTests.sln"
testProjectPath = makeRootPath "tests/SqlClient.Tests/MicrosoftSqlClient.Tests.fsproj"
nugetSpec = "nuget/MicrosoftSqlClient.nuspec"
|}

let projects = [systemSqlProject;microsoftSqlProject]
let authors = ["Dmitry Morozov, Dmitry Sevastianov"]
let summary = "SqlClient F# type providers"
let description = "SqlCommandProvider provides statically typed access to input parameters and result set of T-SQL command in idiomatic F# way.\nSqlProgrammabilityProvider exposes Stored Procedures, User-Defined Types and User-Defined Functions in F# code."
let description = """SqlCommandProvider provides statically typed access to input parameters and result set of T-SQL command in idiomatic F# way.
SqlProgrammabilityProvider exposes Stored Procedures, User-Defined Types and User-Defined Functions in F# code.
"""
let tags = "F# fsharp data typeprovider sql"

let gitHome = "https://github.com/fsprojects"
let gitName = "FSharp.Data.SqlClient"

Expand All @@ -50,7 +70,8 @@
// Generate assembly info files with the right version & up-to-date information

Target.create "AssemblyInfo" (fun _ ->
[ makeRootPath "src/SqlClient/AssemblyInfo.fs", "SqlClient", project, summary ]

[ makeRootPath "src/SqlClient/AssemblyInfo.fs", "SqlClient", systemSqlProject.runtime, summary ]
|> Seq.iter (fun (fileName, title, project, summary) ->
AssemblyInfoFile.createFSharp fileName
[ AssemblyInfo.Title title
Expand All @@ -60,7 +81,7 @@
AssemblyInfo.FileVersion version
AssemblyInfo.InternalsVisibleTo "SqlClient.Tests" ] )

[ makeRootPath "src/SqlClient.DesignTime/AssemblyInfo.fs", "SqlClient.DesignTime", designTimeProject, summary ]
[ makeRootPath "src/SqlClient.DesignTime/AssemblyInfo.fs", "SqlClient.DesignTime", systemSqlProject.designTime, summary ]
|> Seq.iter (fun (fileName, title, project, summary) ->
AssemblyInfoFile.createFSharp fileName
[ AssemblyInfo.Title title
Expand All @@ -69,13 +90,29 @@
AssemblyInfo.Version version
AssemblyInfo.FileVersion version
AssemblyInfo.InternalsVisibleTo "SqlClient.Tests" ] )

[ makeRootPath "src/SqlClient/MicrosoftAssemblyInfo.fs", "MicrosoftSqlClient", microsoftSqlProject.runtime, summary ]
|> Seq.iter (fun (fileName, title, project, summary) ->
AssemblyInfoFile.createFSharp fileName
[ AssemblyInfo.Title title
AssemblyInfo.Product project
AssemblyInfo.Description summary
AssemblyInfo.Version version
AssemblyInfo.FileVersion version
AssemblyInfo.InternalsVisibleTo "MicrosoftSqlClient.Tests" ] )

[ makeRootPath "src/SqlClient.DesignTime/MicrosoftAssemblyInfo.fs", "MicrosoftSqlClient.DesignTime", microsoftSqlProject.designTime, summary ]
|> Seq.iter (fun (fileName, title, project, summary) ->
AssemblyInfoFile.createFSharp fileName
[ AssemblyInfo.Title title
AssemblyInfo.Product project
AssemblyInfo.Description summary
AssemblyInfo.Version version
AssemblyInfo.FileVersion version
AssemblyInfo.InternalsVisibleTo "MicrosoftSqlClient.Tests" ] )
)

let slnPath = makeRootPath "SqlClient.sln"
let testProjectsSlnPath = makeRootPath "TestProjects.sln"
let testSlnPath = makeRootPath "Tests.sln"
let testDir = makeRootPath "tests"
let testProjectPath = makeRootPath "tests/SqlClient.Tests/SqlClient.Tests.fsproj"

let msBuildPaths extraPaths =
[
Expand Down Expand Up @@ -131,10 +168,10 @@
Target.create "Clean" (fun _ ->
Shell.cleanDirs ["bin"; "temp"]
let dnDefault (args: DotNet.Options) = { args with Verbosity = Some DotNet.Verbosity.Quiet }
DotNet.exec dnDefault "clean" slnPath |> ignore
DotNet.exec dnDefault "clean" testProjectsSlnPath |> ignore
DotNet.exec dnDefault "clean" testSlnPath |> ignore
()
for entry in projects do
DotNet.exec dnDefault "clean" entry.slnPath |> ignore
DotNet.exec dnDefault "clean" entry.testProjectsSlnPath |> ignore
DotNet.exec dnDefault "clean" entry.testSlnPath |> ignore
)

Target.create "CleanDocs" (fun _ ->
Expand All @@ -152,9 +189,10 @@
>> DotNet.Options.withCustomParams (Some "--tl")

Target.create "Build" (fun _ ->
for entry in projects do
DotNet.build
(fun args -> { args with Configuration = DotNet.Release } |> dnDefault)
slnPath
(fun args -> { args with Configuration = DotNet.Release } |> dnDefault)
entry.slnPath
)

open System.Data.SqlClient
Expand Down Expand Up @@ -191,12 +229,12 @@
.ConnectionString <- gitHubActionSqlConnectionString
testConfigFile.Save()
gitHubActionSqlConnectionString
SqlConnectionStringBuilder connStr

Check warning on line 232 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.
testConnStr <- Some connStr
database <- Some connStr.InitialCatalog

Check warning on line 234 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.
conn <-
connStr.InitialCatalog <- ""

Check warning on line 236 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.
let cnx = new SqlConnection(string connStr)

Check warning on line 237 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.

Check warning on line 237 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.
cnx.Open()
Some cnx
)
Expand All @@ -208,7 +246,7 @@
//attach
let dbIsMissing =
let query = sprintf "SELECT COUNT(*) FROM sys.databases WHERE name = '%s'" database.Value
use cmd = new SqlCommand(query, conn.Value)

Check warning on line 249 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.

Check warning on line 249 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.
cmd.ExecuteScalar() = box 0

if dbIsMissing then
Expand All @@ -221,13 +259,13 @@
ZipFile.ExtractToDirectory(testsSourceRoot @@ (dataFileName + ".zip"), testsSourceRoot)

let dataPath =
use cmd = new SqlCommand("SELECT SERVERPROPERTY('InstanceDefaultDataPath')", conn.Value)

Check warning on line 262 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.

Check warning on line 262 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.
cmd.ExecuteScalar() |> string
do
let destFileName = dataPath @@ Path.GetFileName(sourceMdf)
File.Copy(sourceMdf, destFileName, overwrite = true)
File.Delete( sourceMdf)
use cmd = conn.Value.CreateCommand(CommandText = sprintf "CREATE DATABASE [%s] ON ( FILENAME = N'%s' ) FOR ATTACH" database.Value destFileName)

Check warning on line 268 in build/build.fs

View workflow job for this annotation

GitHub Actions / build

This construct is deprecated. Use the Microsoft.Data.SqlClient package instead.
cmd.ExecuteNonQuery() |> ignore
)
}
Expand Down Expand Up @@ -264,42 +302,45 @@
}

Target.create "BuildTestProjects" (fun _ ->
pipeline "BuildTestProjects" {
funBuildRestore "test projects sln" testProjectsSlnPath
funBuildRunMSBuild "test projects sln" testProjectsSlnPath
for entry in projects do
if File.Exists entry.testProjectsSlnPath then
pipeline $"BuildTestProjects {entry.runtime}" {
funBuildRestore "test projects sln" entry.testProjectsSlnPath
funBuildRunMSBuild "test projects sln" entry.testProjectsSlnPath
runImmediate
}
}
)

// --------------------------------------------------------------------------------------
// Run the unit tests
Target.create "RunTests" (fun _ ->

let runTests () =
let runTests (entry: {|testSlnPath: string; testProjectPath: string|}) =
let dnTestOptions framework (args: DotNet.TestOptions) =
{ args with
Framework = Some framework
Common = args.Common
NoBuild = true
MSBuildParams = { args.MSBuildParams with DisableInternalBinLog = true }
}
try
DotNet.test (dnTestOptions "net462") testSlnPath
DotNet.test (dnTestOptions "net8.0") testProjectPath

try
DotNet.test (dnTestOptions "net462") entry.testSlnPath
DotNet.test (dnTestOptions "net8.0") entry.testProjectPath
with
| ex ->
Trace.log (sprintf "Test exception: %A" ex)
raise ex

pipeline "RunTests" {
funBuildRestore "test sln" testSlnPath
funBuildRunMSBuild "test sln" testSlnPath

stage "run tests" {
run (fun ctx -> runTests())
}
runImmediate
}
for entry in projects do
pipeline $"RunTests {entry.runtime}" {
funBuildRestore "test sln" entry.testSlnPath
funBuildRunMSBuild "test sln" entry.testSlnPath
stage "run tests" {
run (fun ctx -> runTests {|testSlnPath=entry.testSlnPath; testProjectPath=entry.testProjectPath|})
}
runImmediate
}
)

// --------------------------------------------------------------------------------------
Expand All @@ -311,21 +352,22 @@
let description = description.Replace("\r", "").Replace("\n", "").Replace(" ", " ")
let nugetPath = "packages/build/NuGet.CommandLine/tools/NuGet.exe"

Fake.DotNet.NuGet.NuGet.NuGet (fun p ->
{ p with
Authors = authors
Project = project
Summary = summary
Description = description
Version = version
ReleaseNotes = releaseNotes
Tags = tags
OutputPath = "nuget"
ToolPath = nugetPath
AccessKey = Fake.Core.Environment.environVarOrDefault "nugetkey" ""
Publish = Fake.Core.Environment.hasEnvironVar "nugetkey"
Dependencies = [] })
"nuget/SqlClient.nuspec"
for entry in projects do
Fake.DotNet.NuGet.NuGet.NuGet (fun p ->
{ p with
Authors = authors
Project = entry.runtime
Summary = summary
Description = description
Version = version
ReleaseNotes = releaseNotes
Tags = tags
OutputPath = "nuget"
ToolPath = nugetPath
AccessKey = Fake.Core.Environment.environVarOrDefault "nugetkey" ""
Publish = Fake.Core.Environment.hasEnvironVar "nugetkey"
Dependencies = [] })
entry.nugetSpec
)

// --------------------------------------------------------------------------------------
Expand Down
6 changes: 1 addition & 5 deletions netfx.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,4 @@
<DefineConstants>$(DefineConstants);USE_SQL_SERVER_TYPES_ASSEMBLY;USE_SYSTEM_DATA_COMMON_DBPROVIDERFACTORIES</DefineConstants>
</PropertyGroup>

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

</Project>
</Project>
Loading
Loading