diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..88405c2e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + push: + branches: + - master + - 'release/**' + paths-ignore: + - '**.md' + pull_request: + branches: + - master + - 'release/**' + paths-ignore: + - '**.md' + +jobs: + build: + name: win-build + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + shell: pwsh + run: ./Build/install-dependencies.ps1 + + - name: Dotnet info + shell: pwsh + run: dotnet --info + + - name: Build + shell: pwsh + run: ./Build/build.ps1 -Mode "github" -GithubToken "${{ secrets.GITHUB_TOKEN }}" + + - name: Artifacts + uses: actions/upload-artifact@v3 + with: + name: packages + path: | + .\bin\artifacts\*.nupkg + .\bin\artifacts\*.zip + if-no-files-found: error \ No newline at end of file diff --git a/Build/README.md b/Build/README.md index f5304836..3aedcafc 100644 --- a/Build/README.md +++ b/Build/README.md @@ -3,14 +3,12 @@ build.ps1 is designed to run on windows - PowerShell Desktop 5.1 -- PowerShell [7.3.0](https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0) for .net 7.0 tests +- PowerShell [7.3.0](https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0) for .net 7.0 and 8.0 tests - PowerShell [7.2.1](https://github.com/PowerShell/PowerShell/releases/tag/v7.2.1) for .net 6.0 tests -- PowerShell [7.1.5](https://github.com/PowerShell/PowerShell/releases/tag/v7.1.5) for .net 5.0 tests -- PowerShell [7.0.8](https://github.com/PowerShell/PowerShell/releases/tag/v7.0.8) for .net core 3.1 tests -- Install-Module -Name [InvokeBuild](https://www.powershellgallery.com/packages/InvokeBuild/5.9.12) -RequiredVersion 5.9.12 -- Install-Module -Name [ThirdPartyLibraries](https://www.powershellgallery.com/packages/ThirdPartyLibraries/3.1.2) -RequiredVersion 3.1.2 +- Install-Module -Name [InvokeBuild](https://www.powershellgallery.com/packages/InvokeBuild/5.10.4) -RequiredVersion 5.10.4 +- Install-Module -Name [ThirdPartyLibraries](https://www.powershellgallery.com/packages/ThirdPartyLibraries/3.4.1) -RequiredVersion 3.4.1 - .net framework 4.7.2+ sdk -- .net 7.0 sdk +- .net 8.0 sdk - docker, switched to linux containers ## How to build diff --git a/Build/build-scripts.ps1 b/Build/build-scripts.ps1 deleted file mode 100644 index 08afa64c..00000000 --- a/Build/build-scripts.ps1 +++ /dev/null @@ -1,185 +0,0 @@ -function Get-AssemblyVersion($assemblyInfoCsPath) { - $Anchor = "AssemblyVersion("""; - $lines = Get-Content -Path $assemblyInfoCsPath - - foreach ($line in $lines) { - $index = $line.IndexOf($Anchor); - if ($index -lt 0) { - continue; - } - - $text = $line.Substring($index + $Anchor.Length); - - $index = $text.IndexOf('"'); - $text = $text.Substring(0, $index); - - $version = New-Object -TypeName System.Version -ArgumentList $text - $build = $version.Build - if ($build -le 0) { - $build = 0 - } - - $text = (New-Object -TypeName System.Version -ArgumentList $version.Major, $version.Minor, $build).ToString(); - return $text; - } -} - -function Get-RepositoryCommitId { - git rev-parse HEAD -} - -function Start-Mssql { - $container = Start-Container sqldatabase/mssql:2017 1433 - $port = $container.port - - $builder = New-Object -TypeName System.Data.SqlClient.SqlConnectionStringBuilder - $builder["Initial Catalog"] = "SqlDatabaseTest" - $builder["User Id"] = "sa" - $builder["Password"] = "P@ssw0rd" - $builder["Connect Timeout"] = 5 - - $builder["Data Source"] = ".,$port" - $connectionString = $builder.ToString() - - $builder["Data Source"] = $container.ip - $remoteConnectionString = $builder.ToString() - - return @{ - containerId = $container.containerId - connectionString = $connectionString - remoteConnectionString = $remoteConnectionString - } -} - -function Wait-Mssql($connectionString) { - Wait-Connection System.Data.SqlClient.SqlConnection $connectionString -} - -function Start-Pgsql { - $npgsqldll = Join-Path $env:USERPROFILE ".nuget\packages\npgsql\4.0.11\lib\netstandard2.0\Npgsql.dll" - Add-Type -Path $npgsqldll - - $container = Start-Container sqldatabase/postgres:13.3 5432 - - $builder = New-Object -TypeName Npgsql.NpgsqlConnectionStringBuilder - $builder["Database"] = "sqldatabasetest" - $builder["Username"] = "postgres" - $builder["Password"] = "qwerty" - $builder["Timeout"] = 5 - - $builder.Host = "localhost" - $builder.Port = $container.port.ToString() - $connectionString = $builder.ToString() - - $builder.Host = $container.ip.ToString() - $builder.Port = 5432 - $remoteConnectionString = $builder.ToString() - - return @{ - containerId = $container.containerId - connectionString = $connectionString - remoteConnectionString = $remoteConnectionString - } -} - -function Wait-Pgsql($connectionString) { - Wait-Connection Npgsql.NpgsqlConnection $connectionString -} - -function Start-Mysql { - $sqlConnectordll = Join-Path $env:USERPROFILE "\.nuget\packages\mysqlconnector\1.3.10\lib\netstandard2.0\MySqlConnector.dll" - Add-Type -Path $sqlConnectordll - - $container = Start-Container sqldatabase/mysql:8.0.25 3306 - - $builder = New-Object -TypeName MySqlConnector.MySqlConnectionStringBuilder - $builder["Database"] = "sqldatabasetest" - $builder["User ID"] = "root" - $builder["Password"] = "qwerty" - $builder["ConnectionTimeout"] = 5 - - $builder.Server = "localhost" - $builder.Port = $container.port.ToString() - $connectionString = $builder.ToString() - - $builder.Server = $container.ip.ToString() - $builder.Port = 3306 - $remoteConnectionString = $builder.ToString() - - return @{ - containerId = $container.containerId - connectionString = $connectionString - remoteConnectionString = $remoteConnectionString - } -} - -function Wait-Mysql($connectionString) { - Wait-Connection MySqlConnector.MySqlConnection $connectionString -} - -function Start-Container { - param ( - $image, - $containerPort - ) - - $containerId = exec { - docker run ` - -d ` - -p $containerPort ` - $image - } - - $ip = exec { - docker inspect ` - --format "{{.NetworkSettings.Networks.bridge.IPAddress}}" ` - $containerId - } - - $hostPort = exec { - docker inspect ` - --format "{{(index (index .NetworkSettings.Ports \""$containerPort/tcp\"") 0).HostPort}}" ` - $containerId - } - - return @{ - containerId = $containerId - ip = $ip - port = $hostPort - } -} - -function Wait-Connection { - param ( - $connectionName, - $connectionString, - $timeout = 50 - ) - - function Test-Connection { - $connection = New-Object -TypeName $connectionName -ArgumentList $connectionString - try { - $connection.Open() - } - finally { - $connection.Dispose() - } - } - - for ($i = 0; $i -lt $timeout; $i++) { - try { - Test-Connection - return - } - catch { - Start-Sleep -Seconds 1 - } - } - - try { - Test-Connection - } - catch { - throw "$connectionName $connectionString" - } -} \ No newline at end of file diff --git a/Build/build.ps1 b/Build/build.ps1 index 7cd2fd66..7ce53c07 100644 --- a/Build/build.ps1 +++ b/Build/build.ps1 @@ -1,8 +1,23 @@ #Requires -Version "7.0" -#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.9.12" } +#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.10.4" } +#Requires -Modules @{ ModuleName="ThirdPartyLibraries"; ModuleVersion="3.4.1" } + +[CmdletBinding()] +param ( + [Parameter()] + [ValidateSet("local", "github")] + [string] + $Mode, + + [Parameter()] + [string] + $GithubToken +) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" -$file = Join-Path $PSScriptRoot "build-tasks.ps1" -Invoke-Build -File $file \ No newline at end of file +$file = Join-Path $PSScriptRoot "tasks/build-tasks.ps1" +$task = ($Mode -eq "github") ? "GithubBuild" : "LocalBuild" + +Invoke-Build -File $file -Task $task -GithubToken $GithubToken \ No newline at end of file diff --git a/Build/create-images-tasks.ps1 b/Build/create-images-tasks.ps1 deleted file mode 100644 index 0747aec6..00000000 --- a/Build/create-images-tasks.ps1 +++ /dev/null @@ -1,114 +0,0 @@ -task Default ` - BuildDotnetSdk31 ` - , BuildDotnetRuntime31 ` - , BuildDotnetSdk50 ` - , BuildDotnetRuntime50 ` - , BuildDotnetSdk60 ` - , BuildDotnetRuntime60 ` - , BuildDotnetSdk70 ` - , BuildDotnetRuntime70 ` - , BuildMsSqlDatabase ` - , BuildPgSqlDatabase ` - , BuildMySqlDatabase - -task BuildMsSqlDatabase { - $context = Join-Path $PSScriptRoot "..\Sources\SqlDatabase.Test\Docker" - exec { - docker build ` - -f image-mssql-2017.dockerfile ` - -t sqldatabase/mssql:2017 ` - $context - } -} - -task BuildPgSqlDatabase { - $context = Join-Path $PSScriptRoot "..\Sources\SqlDatabase.Test\Docker" - exec { - docker build ` - -f image-postgres-133.dockerfile ` - -t sqldatabase/postgres:13.3 ` - $context - } -} - -task BuildMySqlDatabase { - $context = Join-Path $PSScriptRoot "..\Sources\SqlDatabase.Test\Docker" - exec { - docker build ` - -f image-mysql-8025.dockerfile ` - -t sqldatabase/mysql:8.0.25 ` - $context - } -} - -task BuildDotnetSdk31 { - exec { - docker build ` - -f image-dotnet-sdk-3.1.dockerfile ` - -t sqldatabase/dotnet_pwsh:3.1-sdk ` - . - } -} - -task BuildDotnetRuntime31 { - exec { - docker build ` - -f image-dotnet-runtime-3.1.dockerfile ` - -t sqldatabase/dotnet_pwsh:3.1-runtime ` - . - } -} - -task BuildDotnetSdk50 { - exec { - docker build ` - -f image-dotnet-sdk-5.0.dockerfile ` - -t sqldatabase/dotnet_pwsh:5.0-sdk ` - . - } -} - -task BuildDotnetRuntime50 { - exec { - docker build ` - -f image-dotnet-runtime-5.0.dockerfile ` - -t sqldatabase/dotnet_pwsh:5.0-runtime ` - . - } -} - -task BuildDotnetSdk60 { - exec { - docker build ` - -f image-dotnet-sdk-6.0.dockerfile ` - -t sqldatabase/dotnet_pwsh:6.0-sdk ` - . - } -} - -task BuildDotnetRuntime60 { - exec { - docker build ` - -f image-dotnet-runtime-6.0.dockerfile ` - -t sqldatabase/dotnet_pwsh:6.0-runtime ` - . - } -} - -task BuildDotnetSdk70 { - exec { - docker build ` - -f image-dotnet-sdk-7.0.dockerfile ` - -t sqldatabase/dotnet_pwsh:7.0-sdk ` - . - } -} - -task BuildDotnetRuntime70 { - exec { - docker build ` - -f image-dotnet-runtime-7.0.dockerfile ` - -t sqldatabase/dotnet_pwsh:7.0-runtime ` - . - } -} \ No newline at end of file diff --git a/Build/create-images.ps1 b/Build/create-images.ps1 index 61280f6a..5938045e 100644 --- a/Build/create-images.ps1 +++ b/Build/create-images.ps1 @@ -1,7 +1,7 @@ #Requires -Version "7.0" -#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.9.12" } +#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.10.4" } Set-StrictMode -Version Latest -$file = Join-Path $PSScriptRoot "create-images-tasks.ps1" +$file = Join-Path $PSScriptRoot "tasks/create-images-tasks.ps1" Invoke-Build -File $file \ No newline at end of file diff --git a/Build/image-dotnet-runtime-3.1.dockerfile b/Build/image-dotnet-runtime-3.1.dockerfile deleted file mode 100644 index 82ddfa70..00000000 --- a/Build/image-dotnet-runtime-3.1.dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM mcr.microsoft.com/dotnet/core/runtime:3.1 - -RUN apt-get update && \ - apt-get install -y liblttng-ust0 && \ - curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.0.5/powershell_7.0.5-1.debian.10_amd64.deb --output powershell_7.0.5-1.debian.10_amd64.deb && \ - dpkg -i powershell_7.0.5-1.debian.10_amd64.deb && \ - apt-get install -f && \ - rm -f powershell_7.0.5-1.debian.10_amd64.deb \ No newline at end of file diff --git a/Build/image-dotnet-runtime-5.0.dockerfile b/Build/image-dotnet-runtime-5.0.dockerfile deleted file mode 100644 index 3cca76ca..00000000 --- a/Build/image-dotnet-runtime-5.0.dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM mcr.microsoft.com/dotnet/runtime:5.0 - -RUN apt-get update && \ - apt-get install -y liblttng-ust0 curl && \ - curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.1.2/powershell_7.1.2-1.debian.10_amd64.deb --output powershell_7.1.2-1.debian.10_amd64.deb && \ - dpkg -i powershell_7.1.2-1.debian.10_amd64.deb && \ - apt-get install -f && \ - rm -f powershell_7.1.2-1.debian.10_amd64.deb \ No newline at end of file diff --git a/Build/image-dotnet-sdk-3.1.dockerfile b/Build/image-dotnet-sdk-3.1.dockerfile deleted file mode 100644 index b2e4803e..00000000 --- a/Build/image-dotnet-sdk-3.1.dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM mcr.microsoft.com/dotnet/core/sdk:3.1 - -RUN apt-get update && \ - apt-get install -y liblttng-ust0 && \ - curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.0.5/powershell_7.0.5-1.debian.10_amd64.deb --output powershell_7.0.5-1.debian.10_amd64.deb && \ - dpkg -i powershell_7.0.5-1.debian.10_amd64.deb && \ - apt-get install -f && \ - rm -f powershell_7.0.5-1.debian.10_amd64.deb \ No newline at end of file diff --git a/Build/image-dotnet-sdk-5.0.dockerfile b/Build/image-dotnet-sdk-5.0.dockerfile deleted file mode 100644 index 9ecbea75..00000000 --- a/Build/image-dotnet-sdk-5.0.dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0 - -RUN apt-get update && \ - apt-get install -y liblttng-ust0 && \ - curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.1.2/powershell_7.1.2-1.debian.10_amd64.deb --output powershell_7.1.2-1.debian.10_amd64.deb && \ - dpkg -i powershell_7.1.2-1.debian.10_amd64.deb && \ - apt-get install -f && \ - rm -f powershell_7.1.2-1.debian.10_amd64.deb \ No newline at end of file diff --git a/Build/install-dependencies.ps1 b/Build/install-dependencies.ps1 new file mode 100644 index 00000000..6a782c06 --- /dev/null +++ b/Build/install-dependencies.ps1 @@ -0,0 +1,34 @@ +#Requires -Version "7.0" + +[CmdletBinding()] +param ( + [Parameter()] + [ValidateSet(".net", "InvokeBuild", "ThirdPartyLibraries")] + [string[]] + $List = (".net", "InvokeBuild", "ThirdPartyLibraries") +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" + +. (Join-Path $PSScriptRoot "scripts/Get-ModuleVersion.ps1") +. (Join-Path $PSScriptRoot "scripts/Invoke-InstallDotNet.ps1") +. (Join-Path $PSScriptRoot "scripts/Invoke-InstallModule.ps1") + +if (".net" -in $List) { + Invoke-InstallDotNet -Version "6.0.319" + Invoke-InstallDotNet -Version "7.0.100" + + $version = (Get-Content -Raw (Join-Path $PSScriptRoot "../Sources/global.json") | ConvertFrom-Json).sdk.version + Invoke-InstallDotNet -Version $version +} + +if ("InvokeBuild" -in $List) { + $version = Get-ModuleVersion "InvokeBuild" + Invoke-InstallModule -Name "InvokeBuild" -Version $version +} + +if ("ThirdPartyLibraries" -in $List) { + $version = Get-ModuleVersion "ThirdPartyLibraries" + Invoke-InstallModule -Name "ThirdPartyLibraries" -Version $version +} \ No newline at end of file diff --git a/Build/scripts/Get-ModuleVersion.ps1 b/Build/scripts/Get-ModuleVersion.ps1 new file mode 100644 index 00000000..1d0fd748 --- /dev/null +++ b/Build/scripts/Get-ModuleVersion.ps1 @@ -0,0 +1,19 @@ +function Get-ModuleVersion { + param ( + [Parameter(Mandatory)] + [string] + $Name + ) + + $sources = Get-Content (Join-Path $PSScriptRoot "../build.ps1") -Raw + $tokens = $null + $errors = $null + $modules = [Management.Automation.Language.Parser]::ParseInput($sources, [ref]$tokens, [ref]$errors).ScriptRequirements.RequiredModules + foreach ($module in $modules) { + if ($module.Name -eq $Name) { + return $module.Version + } + } + + throw "Module $Name not found." +} \ No newline at end of file diff --git a/Build/scripts/Get-ReleaseVersion.ps1 b/Build/scripts/Get-ReleaseVersion.ps1 new file mode 100644 index 00000000..4bf2309e --- /dev/null +++ b/Build/scripts/Get-ReleaseVersion.ps1 @@ -0,0 +1,13 @@ +function Get-ReleaseVersion { + param ( + [Parameter(Mandatory)] + [ValidateScript({ Test-Path $_ })] + [string] + $SourcePath + ) + + $buildProps = Join-Path $SourcePath 'Directory.Build.props' + $xml = Select-Xml -Path $buildProps -XPath 'Project/PropertyGroup/SqlDatabaseVersion' + + $xml.Node.InnerText +} \ No newline at end of file diff --git a/Build/scripts/Invoke-InstallDotNet.ps1 b/Build/scripts/Invoke-InstallDotNet.ps1 new file mode 100644 index 00000000..be0d2032 --- /dev/null +++ b/Build/scripts/Invoke-InstallDotNet.ps1 @@ -0,0 +1,68 @@ +function Invoke-InstallDotNet { + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + [string] + $Version + ) + + function Test-Version { + param ( + [Parameter(Mandatory)] + [System.Management.Automation.SemanticVersion] + $Target, + + [Parameter(Mandatory)] + [System.Management.Automation.SemanticVersion] + $Test + ) + + # 6.0 vs 7.0 + if ($Target.Major -ne $Test.Major -or $Target.Minor -ne $Test.Minor) { + $false + } + else { + # 6.0.0 vs 6.0.1 + # 7.0.100 vs 7.0.100-rc.2.22477.23 + $Target.CompareTo($Test) -le 0 + } + } + + if (Get-Command -Name dotnet -ErrorAction SilentlyContinue) { + $versions = dotnet --list-sdks + foreach ($installedVersion in $versions) { + # 6.0.401 [C:\Program Files\dotnet\sdk] + $test = ($installedVersion -split " ")[0] + + if (Test-Version -Target $Version -Test $test) { + Write-Output ".net sdk $test is alredy installed" + return + } + } + } + + $installDir = "C:\Program Files\dotnet" + $installScript = "dotnet-install.ps1" + + if ($IsLinux) { + $installDir = "/usr/share/dotnet" + $installScript = "dotnet-install.sh" + } + + $downloadDir = Join-Path ([System.IO.Path]::GetTempPath()) "install-dotnet" + if (Test-Path $downloadDir) { + Remove-Item -Path $downloadDir -Recurse -Force + } + + New-Item -Path $downloadDir -ItemType Directory | Out-Null + + $dotnetInstall = Join-Path $downloadDir $installScript + Invoke-WebRequest -Uri "https://dot.net/v1/$installScript" -OutFile $dotnetInstall + + if ($IsLinux) { + chmod +x $dotnetInstall + } + + "$dotnetInstall -Version $Version -InstallDir $installDir" + & $dotnetInstall -Version $Version -InstallDir $installDir +} \ No newline at end of file diff --git a/Build/scripts/Invoke-InstallModule.ps1 b/Build/scripts/Invoke-InstallModule.ps1 new file mode 100644 index 00000000..4621e46e --- /dev/null +++ b/Build/scripts/Invoke-InstallModule.ps1 @@ -0,0 +1,21 @@ +function Invoke-InstallModule { + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + [string] + $Name, + + [Parameter(Mandatory)] + [string] + $Version + ) + + $test = Get-InstalledModule -Name $Name -MinimumVersion $Version -ErrorAction "SilentlyContinue" + if ($test) { + Write-Output "$Name $($test.Version) is alredy installed" + return + } + + Write-Output "Install $Name $version" + Install-Module -Name $Name -RequiredVersion $Version -Force +} \ No newline at end of file diff --git a/Build/scripts/Remove-DirectoryRecurse.ps1 b/Build/scripts/Remove-DirectoryRecurse.ps1 new file mode 100644 index 00000000..0b69ba60 --- /dev/null +++ b/Build/scripts/Remove-DirectoryRecurse.ps1 @@ -0,0 +1,24 @@ +function Remove-DirectoryRecurse { + param ( + [Parameter(Mandatory)] + [string] + $Path, + + [Parameter()] + [string[]] + $Filters + ) + + if (-not (Test-Path $Path)) { + return + } + + if ($Filters) { + foreach ($filter in $Filters) { + Get-ChildItem -Path $Path -Filter $filter -Directory -Recurse | Remove-Item -Recurse -Force + } + } + else { + Remove-Item -Path $Path -Recurse -Force + } +} diff --git a/Build/scripts/Start-Container.ps1 b/Build/scripts/Start-Container.ps1 new file mode 100644 index 00000000..f1e39472 --- /dev/null +++ b/Build/scripts/Start-Container.ps1 @@ -0,0 +1,36 @@ +function Start-Container { + param ( + [Parameter(Mandatory)] + [string] + $Image, + + [Parameter(Mandatory)] + [int] + $ContainerPort + ) + + $containerId = exec { + docker run ` + -d ` + -p $ContainerPort ` + $Image + } + + $ip = exec { + docker inspect ` + --format "{{.NetworkSettings.Networks.bridge.IPAddress}}" ` + $containerId + } + + $hostPort = exec { + docker inspect ` + --format "{{(index (index .NetworkSettings.Ports \""$ContainerPort/tcp\"") 0).HostPort}}" ` + $containerId + } + + return @{ + containerId = $containerId + ip = $ip + port = $hostPort + } +} \ No newline at end of file diff --git a/Build/scripts/Start-Mssql.ps1 b/Build/scripts/Start-Mssql.ps1 new file mode 100644 index 00000000..e21b0f8c --- /dev/null +++ b/Build/scripts/Start-Mssql.ps1 @@ -0,0 +1,24 @@ +function Start-Mssql { + param () + + $container = Start-Container -Image sqldatabase/mssql:2017 -ContainerPort 1433 + $port = $container.port + + $builder = New-Object -TypeName System.Data.SqlClient.SqlConnectionStringBuilder + $builder["Initial Catalog"] = "SqlDatabaseTest" + $builder["User Id"] = "sa" + $builder["Password"] = "P@ssw0rd" + $builder["Connect Timeout"] = 5 + + $builder["Data Source"] = ".,$port" + $connectionString = $builder.ToString() + + $builder["Data Source"] = $container.ip + $remoteConnectionString = $builder.ToString() + + return @{ + containerId = $container.containerId + connectionString = $connectionString + remoteConnectionString = $remoteConnectionString + } +} \ No newline at end of file diff --git a/Build/scripts/Start-Mysql.ps1 b/Build/scripts/Start-Mysql.ps1 new file mode 100644 index 00000000..8bc4727b --- /dev/null +++ b/Build/scripts/Start-Mysql.ps1 @@ -0,0 +1,28 @@ +function Start-Mysql { + param () + + $sqlConnectordll = Join-Path $env:USERPROFILE "\.nuget\packages\mysqlconnector\1.3.10\lib\netstandard2.0\MySqlConnector.dll" + Add-Type -Path $sqlConnectordll + + $container = Start-Container -Image sqldatabase/mysql:8.0.25 -ContainerPort 3306 + + $builder = New-Object -TypeName MySqlConnector.MySqlConnectionStringBuilder + $builder["Database"] = "sqldatabasetest" + $builder["User ID"] = "root" + $builder["Password"] = "qwerty" + $builder["ConnectionTimeout"] = 5 + + $builder.Server = "localhost" + $builder.Port = $container.port.ToString() + $connectionString = $builder.ToString() + + $builder.Server = $container.ip.ToString() + $builder.Port = 3306 + $remoteConnectionString = $builder.ToString() + + return @{ + containerId = $container.containerId + connectionString = $connectionString + remoteConnectionString = $remoteConnectionString + } +} \ No newline at end of file diff --git a/Build/scripts/Start-Pgsql.ps1 b/Build/scripts/Start-Pgsql.ps1 new file mode 100644 index 00000000..d1a0d01c --- /dev/null +++ b/Build/scripts/Start-Pgsql.ps1 @@ -0,0 +1,28 @@ +function Start-Pgsql { + param () + + $npgsqldll = Join-Path $env:USERPROFILE ".nuget\packages\npgsql\4.0.11\lib\netstandard2.0\Npgsql.dll" + Add-Type -Path $npgsqldll + + $container = Start-Container -Image sqldatabase/postgres:13.3 -ContainerPort 5432 + + $builder = New-Object -TypeName Npgsql.NpgsqlConnectionStringBuilder + $builder["Database"] = "sqldatabasetest" + $builder["Username"] = "postgres" + $builder["Password"] = "qwerty" + $builder["Timeout"] = 5 + + $builder.Host = "localhost" + $builder.Port = $container.port.ToString() + $connectionString = $builder.ToString() + + $builder.Host = $container.ip.ToString() + $builder.Port = 5432 + $remoteConnectionString = $builder.ToString() + + return @{ + containerId = $container.containerId + connectionString = $connectionString + remoteConnectionString = $remoteConnectionString + } +} \ No newline at end of file diff --git a/Build/scripts/Wait-Connection.ps1 b/Build/scripts/Wait-Connection.ps1 new file mode 100644 index 00000000..e4468c41 --- /dev/null +++ b/Build/scripts/Wait-Connection.ps1 @@ -0,0 +1,42 @@ +function Wait-Connection { + param ( + [Parameter(Mandatory)] + [string] + $ConnectionName, + + [Parameter(Mandatory)] + [string] + $ConnectionString, + + [Parameter()] + [int] + $Timeout = 50 + ) + + function Test-Connection { + $connection = New-Object -TypeName $ConnectionName -ArgumentList $ConnectionString + try { + $connection.Open() + } + finally { + $connection.Dispose() + } + } + + for ($i = 0; $i -lt $timeout; $i++) { + try { + Test-Connection + return + } + catch { + Start-Sleep -Seconds 1 + } + } + + try { + Test-Connection + } + catch { + throw "$ConnectionName $ConnectionString" + } +} \ No newline at end of file diff --git a/Build/scripts/Wait-Mssql.ps1 b/Build/scripts/Wait-Mssql.ps1 new file mode 100644 index 00000000..1e7ca67c --- /dev/null +++ b/Build/scripts/Wait-Mssql.ps1 @@ -0,0 +1,9 @@ +function Wait-Mssql { + param ( + [Parameter(Mandatory)] + [string] + $ConnectionString + ) + + Wait-Connection -ConnectionName System.Data.SqlClient.SqlConnection -ConnectionString $ConnectionString +} \ No newline at end of file diff --git a/Build/scripts/Wait-Mysql.ps1 b/Build/scripts/Wait-Mysql.ps1 new file mode 100644 index 00000000..0a3ec755 --- /dev/null +++ b/Build/scripts/Wait-Mysql.ps1 @@ -0,0 +1,9 @@ +function Wait-Mysql { + param ( + [Parameter(Mandatory)] + [string] + $ConnectionString + ) + + Wait-Connection -ConnectionName MySqlConnector.MySqlConnection -ConnectionString $ConnectionString +} \ No newline at end of file diff --git a/Build/scripts/Wait-Pgsql.ps1 b/Build/scripts/Wait-Pgsql.ps1 new file mode 100644 index 00000000..dc2ea406 --- /dev/null +++ b/Build/scripts/Wait-Pgsql.ps1 @@ -0,0 +1,9 @@ +function Wait-Pgsql { + param ( + [Parameter(Mandatory)] + [string] + $ConnectionString + ) + + Wait-Connection -ConnectionName Npgsql.NpgsqlConnection -ConnectionString $ConnectionString +} \ No newline at end of file diff --git a/Build/build-tasks.it-linux.ps1 b/Build/tasks/build-tasks.it-linux.ps1 similarity index 90% rename from Build/build-tasks.it-linux.ps1 rename to Build/tasks/build-tasks.it-linux.ps1 index 1a6c2534..90bbc882 100644 --- a/Build/build-tasks.it-linux.ps1 +++ b/Build/tasks/build-tasks.it-linux.ps1 @@ -5,9 +5,9 @@ param( , $image ) -task Test StartDatabase, UnZip, RunTest +task Default StartDatabase, UnZip, RunTest -. .\build-scripts.ps1 +Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName } $containerId = "" $connectionString = "" diff --git a/Build/build-tasks.it-ps-core.ps1 b/Build/tasks/build-tasks.it-ps-core.ps1 similarity index 86% rename from Build/build-tasks.it-ps-core.ps1 rename to Build/tasks/build-tasks.it-ps-core.ps1 index 8140595e..a12bb7d7 100644 --- a/Build/build-tasks.it-ps-core.ps1 +++ b/Build/tasks/build-tasks.it-ps-core.ps1 @@ -4,9 +4,9 @@ param( , $image ) -task Test StartDatabase, RunTest +task Default StartDatabase, RunTest -. .\build-scripts.ps1 +Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName } $containerId = "" $connectionString = "" diff --git a/Build/build-tasks.it-ps-desktop.ps1 b/Build/tasks/build-tasks.it-ps-desktop.ps1 similarity index 81% rename from Build/build-tasks.it-ps-desktop.ps1 rename to Build/tasks/build-tasks.it-ps-desktop.ps1 index c4590e3e..73741b81 100644 --- a/Build/build-tasks.it-ps-desktop.ps1 +++ b/Build/tasks/build-tasks.it-ps-desktop.ps1 @@ -3,9 +3,9 @@ param( , $database ) -task Test RunContainers, CopyModule, PublishModule, RunTest +task Default RunContainers, CopyModule, PublishModule, RunTest -. .\build-scripts.ps1 +Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName } $containerId = "" $connectionString = "" @@ -47,5 +47,7 @@ Exit-Build { Remove-Item -Path $testDir -Force -Recurse } - exec { docker container rm -f $containerId } | Out-Null + if ($containerId) { + exec { docker container rm -f $containerId } | Out-Null + } } \ No newline at end of file diff --git a/Build/build-tasks.it-tool-linux.ps1 b/Build/tasks/build-tasks.it-tool-linux.ps1 similarity index 88% rename from Build/build-tasks.it-tool-linux.ps1 rename to Build/tasks/build-tasks.it-tool-linux.ps1 index 65431c39..87aac1b2 100644 --- a/Build/build-tasks.it-tool-linux.ps1 +++ b/Build/tasks/build-tasks.it-tool-linux.ps1 @@ -4,9 +4,9 @@ param( , $image ) -task Test StartDatabase, RunTest +task Default StartDatabase, RunTest -. .\build-scripts.ps1 +Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName } $containerId = "" $connectionString = "" diff --git a/Build/build-tasks.it-win.ps1 b/Build/tasks/build-tasks.it-win.ps1 similarity index 87% rename from Build/build-tasks.it-win.ps1 rename to Build/tasks/build-tasks.it-win.ps1 index 70a4a607..718408cc 100644 --- a/Build/build-tasks.it-win.ps1 +++ b/Build/tasks/build-tasks.it-win.ps1 @@ -4,9 +4,9 @@ param( , $database ) -task Test StartDatabase, UnZip, RunTest +task Default StartDatabase, UnZip, RunTest -. .\build-scripts.ps1 +Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName } $containerId = "" $connectionString = "" diff --git a/Build/build-tasks.ps1 b/Build/tasks/build-tasks.ps1 similarity index 62% rename from Build/build-tasks.ps1 rename to Build/tasks/build-tasks.ps1 index 52261cd2..f311e9ee 100644 --- a/Build/build-tasks.ps1 +++ b/Build/tasks/build-tasks.ps1 @@ -1,35 +1,45 @@ -task Default Initialize, Clean, Build, ThirdPartyNotices, Pack, UnitTest, IntegrationTest -task Pack PackGlobalTool, PackPoweShellModule, PackNuget452, PackManualDownload +param( + [Parameter()] + [string] + $GithubToken +) + +task GithubBuild Initialize, Clean, Build, ThirdPartyNotices, Pack +task LocalBuild GithubBuild, UnitTest, IntegrationTest + +task Pack PackGlobalTool, PackPoweShellModule, PackNuget472, PackManualDownload task IntegrationTest InitializeIntegrationTest, PsDesktopTest, PsCoreTest, SdkToolTest, NetRuntimeLinuxTest, NetRuntimeWindowsTest -. .\build-scripts.ps1 +Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName } task Initialize { - $sources = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\Sources")) - $bin = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\bin")) + $root = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\..\")) + $sources = Join-Path $root "Sources" + $bin = Join-Path $root "bin" $artifacts = Join-Path $bin "artifacts" $script:settings = @{ - nugetexe = Join-Path $PSScriptRoot "nuget.exe"; - sources = $sources; - bin = $bin; + nugetexe = Join-Path $root "Build\nuget.exe" + sources = $sources + bin = $bin artifacts = $artifacts artifactsPowerShell = Join-Path $artifacts "PowerShell" integrationTests = Join-Path $bin "IntegrationTests" - version = Get-AssemblyVersion (Join-Path $sources "GlobalAssemblyInfo.cs"); - repositoryCommitId = Get-RepositoryCommitId; + version = Get-ReleaseVersion -SourcePath $sources + githubToken = $GithubToken + repositoryCommitId = git rev-parse HEAD } - $script:databases = $("MsSql", "PgSql", "MySql") + $script:frameworks = "net472", "net6.0", "net7.0", "net8.0" + $script:databases = "MsSql", "PgSql", "MySql" Write-Output "PackageVersion: $($settings.version)" Write-Output "CommitId: $($settings.repositoryCommitId)" } task Clean { - if (Test-Path $settings.bin) { - Remove-Item -Path $settings.bin -Recurse -Force - } + Remove-DirectoryRecurse -Path $settings.bin + Remove-DirectoryRecurse -Path $settings.sources -Filters "bin", "obj" New-Item -Path $settings.bin -ItemType Directory | Out-Null } @@ -41,7 +51,7 @@ task Build { } task ThirdPartyNotices { - Invoke-Build -File build-tasks.third-party.ps1 -settings $settings + Invoke-Build -File "build-tasks.third-party.ps1" -settings $settings } task PackGlobalTool { @@ -67,7 +77,7 @@ task PackPoweShellModule { # .psd1 set module version $psdFile = Join-Path $dest "SqlDatabase.psd1" - ((Get-Content -Path $psdFile -Raw) -replace '{{ModuleVersion}}', $settings.version) | Set-Content -Path $psdFile + ((Get-Content -Path $psdFile -Raw) -replace '1.2.3', $settings.version) | Set-Content -Path $psdFile # copy license Copy-Item -Path (Join-Path $settings.sources "..\LICENSE.md") -Destination $dest @@ -78,14 +88,14 @@ task PackPoweShellModule { Get-ChildItem $dest -Include *.pdb -Recurse | Remove-Item } -task PackNuget452 PackPoweShellModule, { +task PackNuget472 PackPoweShellModule, { $bin = $settings.artifactsPowerShell if (-not $bin.EndsWith("\")) { $bin += "\" } $nuspec = Join-Path $settings.sources "SqlDatabase.Package\nuget\package.nuspec" - Exec { + exec { & $($settings.nugetexe) pack ` -NoPackageAnalysis ` -verbosity detailed ` @@ -98,6 +108,9 @@ task PackNuget452 PackPoweShellModule, { } task PackManualDownload PackGlobalTool, PackPoweShellModule, { + Get-ChildItem -Path $settings.bin -Recurse -Directory -Filter "publish" | Remove-Item -Force -Recurse + Get-ChildItem -Path $settings.bin -Recurse -Directory -Filter "win-arm64" | Remove-Item -Force -Recurse + $out = $settings.artifacts $lic = Join-Path $settings.sources "..\LICENSE.md" $thirdParty = Join-Path $settings.bin "ThirdPartyNotices.txt" @@ -107,8 +120,7 @@ task PackManualDownload PackGlobalTool, PackPoweShellModule, { $source = Join-Path $settings.artifactsPowerShell "*" Compress-Archive -Path $source -DestinationPath $destination - $targets = "net452", "netcoreapp3.1", "net5.0", "net6.0", "net7.0" - foreach ($target in $targets) { + foreach ($target in $frameworks) { $destination = Join-Path $out "SqlDatabase.$packageVersion-$target.zip" $source = Join-Path $settings.bin "SqlDatabase\$target\*" Compress-Archive -Path $source, $lic, $thirdParty -DestinationPath $destination @@ -116,15 +128,16 @@ task PackManualDownload PackGlobalTool, PackPoweShellModule, { } task UnitTest { - $builds = @( - @{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "net472" } - @{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "netcoreapp3.1" } - @{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "net5.0" } - @{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "net6.0" } - @{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "net7.0" } - ) + $builds = @() + foreach ($case in $frameworks) { + $builds += @{ + File = "build-tasks.unit-test.ps1" + Sources = $settings.sources + Framework = $case + } + } - Build-Parallel $builds -ShowParameter targetFramework -MaximumBuilds 4 + Build-Parallel $builds -ShowParameter Framework -MaximumBuilds 4 } task InitializeIntegrationTest { @@ -133,9 +146,10 @@ task InitializeIntegrationTest { Remove-Item -Path $dest -Force -Recurse } - Copy-Item -Path (Join-Path $settings.sources "SqlDatabase.Test\IntegrationTests") -Destination $dest -Force -Recurse + Copy-Item -Path (Join-Path $settings.sources "IntegrationTests") -Destination $dest -Force -Recurse + $assemblyScript = Join-Path $settings.bin "..\Examples\CSharpMirationStep\bin\Release\net472\2.1_2.2.*" foreach ($database in $databases) { - Copy-Item -Path (Join-Path $settings.bin "Tests\net472\2.1_2.2.*") -Destination (Join-Path $dest "$database\Upgrade") -Force + Copy-Item -Path $assemblyScript -Destination (Join-Path $dest "$database\Upgrade") -Force } $bashLine = "sed -i 's/\r//g'" @@ -148,7 +162,7 @@ task InitializeIntegrationTest { exec { docker run --rm ` -v $test ` - mcr.microsoft.com/dotnet/core/sdk:3.1 ` + mcr.microsoft.com/dotnet/sdk:7.0 ` bash -c $bashLine } } @@ -157,10 +171,9 @@ task PsDesktopTest { $builds = @() foreach ($database in $databases) { $builds += @{ - File = "build-tasks.it-ps-desktop.ps1"; - Task = "Test"; - settings = $settings; - database = $database; + File = "build-tasks.it-ps-desktop.ps1" + settings = $settings + database = $database } } @@ -193,15 +206,18 @@ task PsCoreTest { , "mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04" , "mcr.microsoft.com/powershell:7.3-ubuntu-20.04") + foreach ($image in $images) { + exec { docker pull $image } + } + $builds = @() foreach ($image in $images) { foreach ($database in $databases) { $builds += @{ - File = "build-tasks.it-ps-core.ps1"; - Task = "Test"; - settings = $settings; - database = $database; - image = $image; + File = "build-tasks.it-ps-core.ps1" + settings = $settings + database = $database + image = $image } } } @@ -211,20 +227,18 @@ task PsCoreTest { task SdkToolTest { $images = $( - "sqldatabase/dotnet_pwsh:3.1-sdk" - , "sqldatabase/dotnet_pwsh:5.0-sdk" - , "sqldatabase/dotnet_pwsh:6.0-sdk" - , "sqldatabase/dotnet_pwsh:7.0-sdk") + "sqldatabase/dotnet_pwsh:6.0-sdk" + , "sqldatabase/dotnet_pwsh:7.0-sdk" + , "sqldatabase/dotnet_pwsh:8.0-sdk") $builds = @() foreach ($image in $images) { foreach ($database in $databases) { $builds += @{ - File = "build-tasks.it-tool-linux.ps1"; - Task = "Test"; - settings = $settings; - database = $database; - image = $image; + File = "build-tasks.it-tool-linux.ps1" + settings = $settings + database = $database + image = $image } } } @@ -234,22 +248,20 @@ task SdkToolTest { task NetRuntimeLinuxTest { $testCases = $( - @{ targetFramework = "netcoreapp3.1"; image = "sqldatabase/dotnet_pwsh:3.1-runtime" } - , @{ targetFramework = "net5.0"; image = "sqldatabase/dotnet_pwsh:5.0-runtime" } - , @{ targetFramework = "net6.0"; image = "sqldatabase/dotnet_pwsh:6.0-runtime" } + @{ targetFramework = "net6.0"; image = "sqldatabase/dotnet_pwsh:6.0-runtime" } , @{ targetFramework = "net7.0"; image = "sqldatabase/dotnet_pwsh:7.0-runtime" } + , @{ targetFramework = "net8.0"; image = "sqldatabase/dotnet_pwsh:8.0-runtime" } ) $builds = @() foreach ($case in $testCases) { foreach ($database in $databases) { $builds += @{ - File = "build-tasks.it-linux.ps1"; - Task = "Test"; - settings = $settings; - targetFramework = $case.targetFramework; - database = $database; - image = $case.image; + File = "build-tasks.it-linux.ps1" + settings = $settings + targetFramework = $case.targetFramework + database = $database + image = $case.image } } } @@ -258,23 +270,14 @@ task NetRuntimeLinuxTest { } task NetRuntimeWindowsTest { - $testCases = $( - "net452" - , "netcoreapp3.1" - , "net5.0" - , "net6.0" - , "net7.0" - ) - $builds = @() - foreach ($case in $testCases) { + foreach ($case in $frameworks) { foreach ($database in $databases) { $builds += @{ - File = "build-tasks.it-win.ps1"; - Task = "Test"; - settings = $settings; - targetFramework = $case; - database = $database; + File = "build-tasks.it-win.ps1" + settings = $settings + targetFramework = $case + database = $database } } } diff --git a/Build/build-tasks.third-party.ps1 b/Build/tasks/build-tasks.third-party.ps1 similarity index 63% rename from Build/build-tasks.third-party.ps1 rename to Build/tasks/build-tasks.third-party.ps1 index b0d83e82..52b3d09f 100644 --- a/Build/build-tasks.third-party.ps1 +++ b/Build/tasks/build-tasks.third-party.ps1 @@ -5,18 +5,12 @@ param( task Default Update, Test, Publish Enter-Build { - $repository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "third-party-libraries")) - - $sourceDir = $settings.sources - $sources = (Join-Path $sourceDir "SqlDatabase"), - (Join-Path $sourceDir "SqlDatabase.Test"), - (Join-Path $sourceDir "SqlDatabase.PowerShell"), - (Join-Path $sourceDir "SqlDatabase.PowerShell.Test"), - (Join-Path $sourceDir "SqlDatabase.Test") + $repository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../third-party-libraries")) + $sources = $settings.sources } task Update { - Update-ThirdPartyLibrariesRepository -AppName "SqlDatabase" -Source $sources -Repository $repository + Update-ThirdPartyLibrariesRepository -AppName "SqlDatabase" -Source $sources -Repository $repository -GithubPersonalAccessToken $settings.githubToken } task Test { diff --git a/Build/build-tasks.unit-test.ps1 b/Build/tasks/build-tasks.unit-test.ps1 similarity index 57% rename from Build/build-tasks.unit-test.ps1 rename to Build/tasks/build-tasks.unit-test.ps1 index 2e543e05..05c1b871 100644 --- a/Build/build-tasks.unit-test.ps1 +++ b/Build/tasks/build-tasks.unit-test.ps1 @@ -1,37 +1,57 @@ param( - $settings, - $targetFramework + [Parameter(Mandatory)] + [ValidateScript({ Test-Path $_ })] + [string] + $Sources, + + [Parameter(Mandatory)] + [ValidateSet("net472", "net6.0", "net7.0", "net8.0")] + [string] + $Framework ) -task Test RunContainers, UpdateConfig, RunTests +task Default RunContainers, UpdateConfig, RunTests -. .\build-scripts.ps1 +Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName } -$mssqlContainerId = "" -$mssqlConnectionString = "empty" -$pgsqlContainerId = "" -$pgsqlConnectionString = "empty" -$mysqlContainerId = "" -$mysqlConnectionString = "empty" -$testDir = Join-Path (Join-Path $settings.bin "Tests") $targetFramework +$containerIds = @() +$mssqlConnectionString = "" +$pgsqlConnectionString = "" +$mysqlConnectionString = "" Enter-Build { - Write-Output "$testDir" + $testList = Get-ChildItem -Path $Sources -Recurse -Filter *.Test.dll ` + | Where-Object FullName -Match \\$Framework\\ ` + | Where-Object FullName -Match \\bin\\Release\\ ` + | Where-Object FullName -NotMatch \\$Framework\\ref\\ ` + | ForEach-Object { $_.FullName } + + if (-not $testList) { + throw "Test list is empty." + } + + $testList +} + +Exit-Build { + if ($containerIds) { + exec { docker container rm -f $containerIds } | Out-Null + } } task RunContainers { $info = Start-Mssql - $script:mssqlContainerId = $info.containerId + $script:containerIds += $info.containerId $script:mssqlConnectionString = $info.connectionString Write-Output $mssqlConnectionString $info = Start-Pgsql - $script:pgsqlContainerId = $info.containerId + $script:containerIds += $info.containerId $script:pgsqlConnectionString = $info.connectionString Write-Output $pgsqlConnectionString $info = Start-Mysql - $script:mysqlContainerId = $info.containerId + $script:containerIds += $info.containerId $script:mysqlConnectionString = $info.connectionString Write-Output $mysqlConnectionString @@ -40,9 +60,8 @@ task RunContainers { Wait-Mysql $mysqlConnectionString } - task UpdateConfig { - $configFiles = Get-ChildItem -Path $testDir -Filter *.dll.config + $configFiles = $testList | ForEach-Object { Split-Path -Path $_ -Parent } | Sort-Object | Get-Unique | Get-ChildItem -Filter *.dll.config foreach ($configFile in $configFiles) { [xml]$config = Get-Content $configFile @@ -67,19 +86,5 @@ task UpdateConfig { } task RunTests { - $testList = Get-ChildItem -Path $testDir -Filter *.Test.dll ` - | Where-Object FullName -NotMatch \\ref\\ ` - | ForEach-Object {$_.FullName} - - if (-not $testList.Count) { - throw "Test list is empty." - } - - $testList exec { dotnet vstest $testList } } - - -Exit-Build { - exec { docker container rm -f $mssqlContainerId $pgsqlContainerId $mysqlContainerId } | Out-Null -} \ No newline at end of file diff --git a/Build/tasks/create-images-tasks.ps1 b/Build/tasks/create-images-tasks.ps1 new file mode 100644 index 00000000..bc718538 --- /dev/null +++ b/Build/tasks/create-images-tasks.ps1 @@ -0,0 +1,104 @@ +task Default ` + BuildDotnetSdk60 ` + , BuildDotnetSdk70 ` + , BuildDotnetSdk80 ` + , BuildDotnetRuntime60 ` + , BuildDotnetRuntime70 ` + , BuildDotnetRuntime80 ` + , BuildMsSqlDatabase ` + , BuildPgSqlDatabase ` + , BuildMySqlDatabase + +Enter-Build { + $context = Join-Path $PSScriptRoot "..\..\Sources\Docker" +} + +task BuildMsSqlDatabase { + $dockerfile = Join-Path $context "image-mssql-2017.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/mssql:2017 ` + $context + } +} + +task BuildPgSqlDatabase { + $dockerfile = Join-Path $context "image-postgres-133.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/postgres:13.3 ` + $context + } +} + +task BuildMySqlDatabase { + $dockerfile = Join-Path $context "image-mysql-8025.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/mysql:8.0.25 ` + $context + } +} + +task BuildDotnetSdk60 { + $dockerfile = Join-Path $context "image-dotnet-sdk-6.0.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/dotnet_pwsh:6.0-sdk ` + . + } +} + +task BuildDotnetRuntime60 { + $dockerfile = Join-Path $context "image-dotnet-runtime-6.0.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/dotnet_pwsh:6.0-runtime ` + . + } +} + +task BuildDotnetSdk70 { + $dockerfile = Join-Path $context "image-dotnet-sdk-7.0.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/dotnet_pwsh:7.0-sdk ` + . + } +} + +task BuildDotnetRuntime70 { + $dockerfile = Join-Path $context "image-dotnet-runtime-7.0.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/dotnet_pwsh:7.0-runtime ` + . + } +} + +task BuildDotnetSdk80 { + $dockerfile = Join-Path $context "image-dotnet-sdk-8.0.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/dotnet_pwsh:8.0-sdk ` + . + } +} + +task BuildDotnetRuntime80 { + $dockerfile = Join-Path $context "image-dotnet-runtime-8.0.dockerfile" + exec { + docker build ` + -f $dockerfile ` + -t sqldatabase/dotnet_pwsh:8.0-runtime ` + . + } +} \ No newline at end of file diff --git a/Build/third-party-libraries/configuration/appsettings.json b/Build/third-party-libraries/configuration/appsettings.json index d1a5c7b9..ce053525 100644 --- a/Build/third-party-libraries/configuration/appsettings.json +++ b/Build/third-party-libraries/configuration/appsettings.json @@ -8,7 +8,7 @@ }, "internalPackages": { "byName": [ "StyleCop\\.Analyzers" ], - "byProjectName": [ "\\.Test$" ] + "byProjectName": [ "\\.Test*" ] } }, "npmjs.com": { diff --git a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/index.json b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/index.json similarity index 60% rename from Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/index.json rename to Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/index.json index 8a94c743..ccd65c2b 100644 --- a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "Apache-2.0", "Status": "AutomaticallyApproved" @@ -8,16 +9,16 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" ], "Dependencies": [ { "Name": "System.Diagnostics.EventLog", "Version": "4.7.0" + }, + { + "Name": "System.Reflection.Emit", + "Version": "4.7.0" } ] } @@ -26,20 +27,18 @@ { "Subject": "package", "Code": "Apache-2.0", - "HRef": "https://licenses.nuget.org/Apache-2.0", - "Description": null + "HRef": "https://licenses.nuget.org/Apache-2.0" }, { "Subject": "repository", "Code": null, "HRef": "https://github.com/castleproject/Core", - "Description": "License should be verified on https://github.com/castleproject/Core" + "Description": "License code NOASSERTION" }, { "Subject": "project", "Code": null, - "HRef": "http://www.castleproject.org/", - "Description": "License should be verified on http://www.castleproject.org/" + "HRef": "http://www.castleproject.org/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/package-LICENSE b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/package-LICENSE similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/package-LICENSE rename to Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/package-LICENSE diff --git a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/package.nuspec similarity index 98% rename from Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/package.nuspec index 04839f87..a2179779 100644 --- a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/package.nuspec @@ -2,7 +2,7 @@ Castle.Core - 5.1.0 + 5.1.1 Castle Project Contributors Apache-2.0 https://licenses.nuget.org/Apache-2.0 diff --git a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/readme.md b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/readme.md similarity index 62% rename from Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/readme.md index 6d4882ed..1de67e47 100644 --- a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/readme.md @@ -1,15 +1,15 @@ -Castle.Core [5.1.0](https://www.nuget.org/packages/Castle.Core/5.1.0) +Castle.Core [5.1.1](https://www.nuget.org/packages/Castle.Core/5.1.1) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [Apache-2.0](../../../../licenses/apache-2.0) - package license: [Apache-2.0](https://licenses.nuget.org/Apache-2.0) -- repository license: [Unknown](https://github.com/castleproject/Core) , License should be verified on https://github.com/castleproject/Core -- project license: [Unknown](http://www.castleproject.org/) , License should be verified on http://www.castleproject.org/ +- repository license: [Unknown](https://github.com/castleproject/Core) , License code NOASSERTION +- project license: [Unknown](http://www.castleproject.org/) Description ----------- @@ -20,11 +20,12 @@ Remarks no remarks -Dependencies 1 +Dependencies 2 ----------- |Name|Version| |----------|:----| |[System.Diagnostics.EventLog](../../../../packages/nuget.org/system.diagnostics.eventlog/4.7.0)|4.7.0| +|[System.Reflection.Emit](../../../../packages/nuget.org/system.reflection.emit/4.7.0)|4.7.0| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/repository-LICENSE similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/repository-LICENSE rename to Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/repository-LICENSE diff --git a/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/castle.core/5.1.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/castle.core/5.1.1/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/index.json b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/index.json similarity index 63% rename from Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/index.json rename to Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/index.json index 0f1a186f..dfadd243 100644 --- a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/index.json +++ b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "Apache-2.0", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ] } ], @@ -20,20 +20,19 @@ { "Subject": "package", "Code": "Apache-2.0", - "HRef": "https://licenses.nuget.org/Apache-2.0", - "Description": null + "HRef": "https://licenses.nuget.org/Apache-2.0" }, { "Subject": "repository", "Code": null, "HRef": "https://github.com/DapperLib/Dapper", - "Description": "License should be verified on https://github.com/DapperLib/Dapper" + "Description": "License code NOASSERTION" }, { "Subject": "project", "Code": null, "HRef": "https://github.com/DapperLib/Dapper", - "Description": "License should be verified on https://github.com/DapperLib/Dapper" + "Description": "License code NOASSERTION" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/package.nuspec b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/package.nuspec similarity index 91% rename from Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/package.nuspec index 9404cbf7..75ea09ac 100644 --- a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/package.nuspec @@ -2,7 +2,7 @@ Dapper.StrongName - 2.0.123 + 2.1.15 Dapper (Strong Named) Sam Saffron,Marc Gravell,Nick Craver Sam Saffron,Marc Gravell,Nick Craver @@ -14,7 +14,7 @@ https://dapperlib.github.io/Dapper/ 2019 Stack Exchange, Inc. orm sql micro-orm - + @@ -23,5 +23,6 @@ Dapper.png + readme.md \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/project-License.txt b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/project-License.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/project-License.txt rename to Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/project-License.txt diff --git a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/readme.md b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/readme.md similarity index 64% rename from Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/readme.md rename to Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/readme.md index d9ad4978..ea8883fd 100644 --- a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/readme.md @@ -1,15 +1,15 @@ -Dapper.StrongName [2.0.123](https://www.nuget.org/packages/Dapper.StrongName/2.0.123) +Dapper.StrongName [2.1.15](https://www.nuget.org/packages/Dapper.StrongName/2.1.15) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [Apache-2.0](../../../../licenses/apache-2.0) - package license: [Apache-2.0](https://licenses.nuget.org/Apache-2.0) -- repository license: [Unknown](https://github.com/DapperLib/Dapper) , License should be verified on https://github.com/DapperLib/Dapper -- project license: [Unknown](https://github.com/DapperLib/Dapper) , License should be verified on https://github.com/DapperLib/Dapper +- repository license: [Unknown](https://github.com/DapperLib/Dapper) , License code NOASSERTION +- project license: [Unknown](https://github.com/DapperLib/Dapper) , License code NOASSERTION Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/remarks.md b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/remarks.md rename to Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/repository-License.txt b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/repository-License.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/repository-License.txt rename to Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/repository-License.txt diff --git a/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.0.123/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/dapper.strongname/2.1.15/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/index.json b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/index.json similarity index 58% rename from Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/index.json rename to Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/index.json index 5c6c8151..524185ce 100644 --- a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,20 +9,16 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" ], "Dependencies": [ { "Name": "EmptyFiles", - "Version": "2.8.0" + "Version": "4.4.0" }, { "Name": "System.Management", - "Version": "5.0.0" + "Version": "6.0.1" } ] } @@ -30,20 +27,17 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/VerifyTests/DiffEngine.git", - "Description": null + "HRef": "https://github.com/VerifyTests/DiffEngine.git" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/VerifyTests/DiffEngine", - "Description": null + "HRef": "https://github.com/VerifyTests/DiffEngine" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/package.nuspec similarity index 54% rename from Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/package.nuspec index 5929b640..e76b0bee 100644 --- a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/package.nuspec @@ -2,61 +2,61 @@ DiffEngine - 10.0.0 + 11.3.0 https://github.com/VerifyTests/DiffEngine/graphs/contributors MIT https://licenses.nuget.org/MIT icon.png https://github.com/VerifyTests/DiffEngine Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries. - Copyright 2022. All rights reserved + Copyright 2023. All rights reserved Testing, Snapshot, Diff, Compare - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/project-license.txt b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/project-license.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/project-license.txt rename to Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/project-license.txt diff --git a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/readme.md b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/readme.md similarity index 73% rename from Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/readme.md index 00489c79..01116770 100644 --- a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/readme.md @@ -1,9 +1,9 @@ -DiffEngine [10.0.0](https://www.nuget.org/packages/DiffEngine/10.0.0) +DiffEngine [11.3.0](https://www.nuget.org/packages/DiffEngine/11.3.0) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) @@ -25,7 +25,7 @@ Dependencies 2 |Name|Version| |----------|:----| -|[EmptyFiles](../../../../packages/nuget.org/emptyfiles/2.8.0)|2.8.0| -|[System.Management](../../../../packages/nuget.org/system.management/5.0.0)|5.0.0| +|[EmptyFiles](../../../../packages/nuget.org/emptyfiles/4.4.0)|4.4.0| +|[System.Management](../../../../packages/nuget.org/system.management/6.0.1)|6.0.1| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/repository-license.txt b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/repository-license.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/repository-license.txt rename to Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/repository-license.txt diff --git a/Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/diffengine/10.0.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/diffengine/11.3.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/package.nuspec deleted file mode 100644 index 27fce73e..00000000 --- a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/package.nuspec +++ /dev/null @@ -1,20 +0,0 @@ - - - - EmptyFiles - 2.8.0 - https://github.com/SimonCropp/EmptyFiles/graphs/contributors - MIT - https://licenses.nuget.org/MIT - icon.png - https://github.com/SimonCropp/EmptyFiles - A collection of minimal binary files. - Copyright 2021. All rights reserved - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/index.json b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/index.json similarity index 53% rename from Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/index.json rename to Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/index.json index 4d10c323..ee532dc8 100644 --- a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,13 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" + ], + "Dependencies": [ + { + "Name": "System.Memory", + "Version": "4.5.5" + } ] } ], @@ -20,20 +23,17 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/SimonCropp/EmptyFiles.git", - "Description": null + "HRef": "https://github.com/SimonCropp/EmptyFiles.git" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/SimonCropp/EmptyFiles", - "Description": null + "HRef": "https://github.com/SimonCropp/EmptyFiles" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/package.nuspec new file mode 100644 index 00000000..efb63dda --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/package.nuspec @@ -0,0 +1,30 @@ + + + + EmptyFiles + 4.4.0 + https://github.com/SimonCropp/EmptyFiles/graphs/contributors + MIT + https://licenses.nuget.org/MIT + icon.png + https://github.com/SimonCropp/EmptyFiles + A collection of minimal binary files. + Copyright 2023. All rights reserved + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/project-license.txt b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/project-license.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/project-license.txt rename to Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/project-license.txt diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/readme.md b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/readme.md similarity index 66% rename from Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/readme.md index 9cd0372b..d1cf40c7 100644 --- a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/readme.md @@ -1,9 +1,9 @@ -EmptyFiles [2.8.0](https://www.nuget.org/packages/EmptyFiles/2.8.0) +EmptyFiles [4.4.0](https://www.nuget.org/packages/EmptyFiles/4.4.0) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) @@ -20,8 +20,11 @@ Remarks no remarks -Dependencies 0 +Dependencies 1 ----------- +|Name|Version| +|----------|:----| +|[System.Memory](../../../../packages/nuget.org/system.memory/4.5.5)|4.5.5| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/repository-license.txt b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/repository-license.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/repository-license.txt rename to Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/repository-license.txt diff --git a/Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/emptyfiles/2.8.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/emptyfiles/4.4.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/project-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/project-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/project-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/repository-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/repository-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/index.json new file mode 100644 index 00000000..d4d492c6 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/index.json @@ -0,0 +1,37 @@ +{ + "Source": "https://api.nuget.org/v3/index.json", + "License": { + "Code": "ms-net-library", + "Status": "AutomaticallyApproved" + }, + "UsedBy": [ + { + "Name": "SqlDatabase", + "InternalOnly": true, + "TargetFrameworks": [ + "net472", + "net6.0", + "net7.0", + "net8.0" + ] + } + ], + "Licenses": [ + { + "Subject": "package", + "Code": "ms-net-library", + "HRef": "LICENSE_NET.txt", + "Description": "The license file is identical to the file from version 17.4.0." + }, + { + "Subject": "repository", + "Code": "MIT", + "HRef": "https://github.com/microsoft/vstest" + }, + { + "Subject": "project", + "Code": "MIT", + "HRef": "https://github.com/microsoft/vstest" + } + ] +} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/package-LICENSE_NET.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/package-LICENSE_NET.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/package-LICENSE_NET.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/package-LICENSE_NET.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/package.nuspec similarity index 75% rename from Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/package.nuspec index 458733c3..1a5d6895 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/package.nuspec @@ -2,20 +2,18 @@ Microsoft.CodeCoverage - 17.4.0 - Microsoft.CodeCoverage + 17.7.2 Microsoft - Microsoft true LICENSE_NET.txt https://aka.ms/deprecateLicenseUrl Icon.png - https://github.com/microsoft/vstest/ - http://go.microsoft.com/fwlink/?LinkID=288859 + https://github.com/microsoft/vstest Microsoft.CodeCoverage package brings infra for collecting code coverage from vstest.console.exe and "dotnet test". © Microsoft Corporation. All rights reserved. vstest visual-studio unittest testplatform mstest microsoft test testing codecoverage code-coverage - + true + diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/project-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/project-LICENSE similarity index 95% rename from Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/project-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/project-LICENSE index 984713a4..d859446c 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/project-LICENSE.TXT +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/project-LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) .NET Foundation and Contributors +Copyright (c) Microsoft Corporation All rights reserved. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/readme.md similarity index 57% rename from Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/readme.md index 205a4366..615d9061 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/readme.md @@ -1,15 +1,15 @@ -Microsoft.CodeCoverage [17.4.0](https://www.nuget.org/packages/Microsoft.CodeCoverage/17.4.0) +Microsoft.CodeCoverage [17.7.2](https://www.nuget.org/packages/Microsoft.CodeCoverage/17.7.2) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [ms-net-library](../../../../licenses/ms-net-library) -- package license: [Unknown]() +- package license: [ms-net-library]() , The license file is identical to the file from version 17.4.0. - repository license: [MIT](https://github.com/microsoft/vstest) -- project license: [MIT](https://github.com/microsoft/vstest/) +- project license: [MIT](https://github.com/microsoft/vstest) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/repository-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/repository-LICENSE similarity index 95% rename from Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/repository-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/repository-LICENSE index 984713a4..d859446c 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/repository-LICENSE.TXT +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/repository-LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) .NET Foundation and Contributors +Copyright (c) Microsoft Corporation All rights reserved. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.7.2/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/index.json similarity index 50% rename from Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/index.json rename to Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/index.json index 79494e46..6786e835 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -6,13 +7,8 @@ "UsedBy": [ { "Name": "SqlDatabase", - "InternalOnly": false, + "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ] } @@ -21,14 +17,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/package.nuspec new file mode 100644 index 00000000..bc9e1494 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/package.nuspec @@ -0,0 +1,67 @@ + + + + Microsoft.CSharp + 4.7.0 + Microsoft.CSharp + Microsoft + microsoft,dotnetframework + false + MIT + https://licenses.nuget.org/MIT + https://github.com/dotnet/corefx + http://go.microsoft.com/fwlink/?LinkID=288859 + Provides support for compilation and code generation, including dynamic, using the C# language. + +Commonly Used Types: +Microsoft.CSharp.RuntimeBinder.Binder +Microsoft.CSharp.RuntimeBinder.RuntimeBinderException +Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo +Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags +Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags + +When using NuGet 3.x this package requires at least version 3.4. + https://go.microsoft.com/fwlink/?LinkID=799421 + © Microsoft Corporation. All rights reserved. + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/readme.md new file mode 100644 index 00000000..9a3779c9 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/readme.md @@ -0,0 +1,35 @@ +Microsoft.CSharp [4.7.0](https://www.nuget.org/packages/Microsoft.CSharp/4.7.0) +-------------------- + +Used by: SqlDatabase internal + +Target frameworks: netstandard2.0 + +License: [MIT](../../../../licenses/mit) + +- package license: [MIT](https://licenses.nuget.org/MIT) +- project license: [Unknown](https://github.com/dotnet/corefx) + +Description +----------- +Provides support for compilation and code generation, including dynamic, using the C# language. + +Commonly Used Types: +Microsoft.CSharp.RuntimeBinder.Binder +Microsoft.CSharp.RuntimeBinder.RuntimeBinderException +Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo +Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags +Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags + +When using NuGet 3.x this package requires at least version 3.4. + +Remarks +----------- +no remarks + + +Dependencies 0 +----------- + + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.csharp/4.7.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/project-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/project-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/project-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/repository-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/repository-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/index.json similarity index 60% rename from Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/index.json rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/index.json index 48f4f38f..3f13abfb 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "ms-net-library", "Status": "AutomaticallyApproved" @@ -8,20 +9,19 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ], "Dependencies": [ { "Name": "Microsoft.CodeCoverage", - "Version": "17.4.0" + "Version": "17.7.2" }, { "Name": "Microsoft.TestPlatform.TestHost", - "Version": "17.4.0" + "Version": "17.7.2" } ] } @@ -29,21 +29,19 @@ "Licenses": [ { "Subject": "package", - "Code": null, - "HRef": null, - "Description": null + "Code": "ms-net-library", + "HRef": "LICENSE_NET.txt", + "Description": "The license file is identical to the file from version 17.4.0." }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest", - "Description": null + "HRef": "https://github.com/microsoft/vstest" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest/", - "Description": null + "HRef": "https://github.com/microsoft/vstest" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/package-LICENSE_NET.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/package-LICENSE_NET.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/package-LICENSE_NET.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/package-LICENSE_NET.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/package.nuspec similarity index 68% rename from Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/package.nuspec index e1842716..b3e84fcf 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/package.nuspec @@ -2,27 +2,25 @@ Microsoft.NET.Test.Sdk - 17.4.0 - Microsoft.NET.Test.Sdk + 17.7.2 Microsoft - Microsoft true LICENSE_NET.txt https://aka.ms/deprecateLicenseUrl Icon.png - https://github.com/microsoft/vstest/ - http://go.microsoft.com/fwlink/?LinkID=288859 + https://github.com/microsoft/vstest The MSbuild targets and properties for building .NET test projects. © Microsoft Corporation. All rights reserved. vstest visual-studio unittest testplatform mstest microsoft test testing - + true + - - + + - + diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/project-LICENSE similarity index 95% rename from Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/project-LICENSE index 984713a4..d859446c 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/package-LICENSE.txt +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/project-LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) .NET Foundation and Contributors +Copyright (c) Microsoft Corporation All rights reserved. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/readme.md similarity index 57% rename from Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/readme.md index 982ca39c..51309baf 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.4.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/readme.md @@ -1,15 +1,15 @@ -Microsoft.NET.Test.Sdk [17.4.0](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.4.0) +Microsoft.NET.Test.Sdk [17.7.2](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.7.2) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [ms-net-library](../../../../licenses/ms-net-library) -- package license: [Unknown]() +- package license: [ms-net-library]() , The license file is identical to the file from version 17.4.0. - repository license: [MIT](https://github.com/microsoft/vstest) -- project license: [MIT](https://github.com/microsoft/vstest/) +- project license: [MIT](https://github.com/microsoft/vstest) Description ----------- @@ -25,7 +25,7 @@ Dependencies 2 |Name|Version| |----------|:----| -|[Microsoft.CodeCoverage](../../../../packages/nuget.org/microsoft.codecoverage/17.4.0)|17.4.0| -|[Microsoft.TestPlatform.TestHost](../../../../packages/nuget.org/microsoft.testplatform.testhost/17.4.0)|17.4.0| +|[Microsoft.CodeCoverage](../../../../packages/nuget.org/microsoft.codecoverage/17.7.2)|17.7.2| +|[Microsoft.TestPlatform.TestHost](../../../../packages/nuget.org/microsoft.testplatform.testhost/17.7.2)|17.7.2| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/project-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/repository-LICENSE similarity index 95% rename from Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/project-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/repository-LICENSE index 984713a4..d859446c 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/project-LICENSE.TXT +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/repository-LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) .NET Foundation and Contributors +Copyright (c) Microsoft Corporation All rights reserved. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.net.test.sdk/17.7.2/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/project-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/project-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/project-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/repository-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/repository-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/index.json similarity index 62% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/index.json rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/index.json index dec14c1c..f4be26eb 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "ms-net-library", "Status": "AutomaticallyApproved" @@ -8,16 +9,15 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ], "Dependencies": [ { "Name": "NuGet.Frameworks", - "Version": "5.11.0" + "Version": "6.5.0" }, { "Name": "System.Reflection.Metadata", @@ -29,21 +29,19 @@ "Licenses": [ { "Subject": "package", - "Code": null, - "HRef": null, - "Description": null + "Code": "ms-net-library", + "HRef": "LICENSE_NET.txt", + "Description": "The license file is identical to the file from version 17.4.0." }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest", - "Description": null + "HRef": "https://github.com/microsoft/vstest" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest/", - "Description": null + "HRef": "https://github.com/microsoft/vstest" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/package-LICENSE_NET.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/package-LICENSE_NET.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/package-LICENSE_NET.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/package-LICENSE_NET.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/package.nuspec similarity index 79% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/package.nuspec index 26886126..3445be41 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/package.nuspec @@ -2,32 +2,30 @@ Microsoft.TestPlatform.ObjectModel - 17.4.0 - Microsoft.TestPlatform.ObjectModel + 17.7.2 Microsoft - Microsoft true LICENSE_NET.txt https://aka.ms/deprecateLicenseUrl Icon.png - https://github.com/microsoft/vstest/ - http://go.microsoft.com/fwlink/?LinkID=288859 + https://github.com/microsoft/vstest The Microsoft Test Platform Object Model. © Microsoft Corporation. All rights reserved. vstest visual-studio unittest testplatform mstest microsoft test testing - + true + - + - + - + diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/project-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/project-LICENSE new file mode 100644 index 00000000..d859446c --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/project-LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) Microsoft Corporation + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/readme.md similarity index 61% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/readme.md index 57872dab..3e833b6e 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/readme.md @@ -1,15 +1,15 @@ -Microsoft.TestPlatform.ObjectModel [17.4.0](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.4.0) +Microsoft.TestPlatform.ObjectModel [17.7.2](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.7.2) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [ms-net-library](../../../../licenses/ms-net-library) -- package license: [Unknown]() +- package license: [ms-net-library]() , The license file is identical to the file from version 17.4.0. - repository license: [MIT](https://github.com/microsoft/vstest) -- project license: [MIT](https://github.com/microsoft/vstest/) +- project license: [MIT](https://github.com/microsoft/vstest) Description ----------- @@ -25,7 +25,7 @@ Dependencies 2 |Name|Version| |----------|:----| -|[NuGet.Frameworks](../../../../packages/nuget.org/nuget.frameworks/5.11.0)|5.11.0| +|[NuGet.Frameworks](../../../../packages/nuget.org/nuget.frameworks/6.5.0)|6.5.0| |[System.Reflection.Metadata](../../../../packages/nuget.org/system.reflection.metadata/1.6.0)|1.6.0| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/repository-LICENSE new file mode 100644 index 00000000..d859446c --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/repository-LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) Microsoft Corporation + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/project-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/project-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/project-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/repository-LICENSE deleted file mode 100644 index a31c5558..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/repository-LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/index.json similarity index 60% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/index.json rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/index.json index 41da6a47..63502005 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "ms-net-library", "Status": "AutomaticallyApproved" @@ -8,20 +9,19 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ], "Dependencies": [ { "Name": "Microsoft.TestPlatform.ObjectModel", - "Version": "17.4.0" + "Version": "17.7.2" }, { "Name": "Newtonsoft.Json", - "Version": "13.0.2" + "Version": "13.0.1" } ] } @@ -29,21 +29,19 @@ "Licenses": [ { "Subject": "package", - "Code": null, - "HRef": null, - "Description": null + "Code": "ms-net-library", + "HRef": "LICENSE_NET.txt", + "Description": "The license file is identical to the file from version 17.4.0." }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest", - "Description": null + "HRef": "https://github.com/microsoft/vstest" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest/", - "Description": null + "HRef": "https://github.com/microsoft/vstest" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/package-LICENSE_NET.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/package-LICENSE_NET.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/package-LICENSE_NET.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/package-LICENSE_NET.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/package.nuspec similarity index 75% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/package.nuspec index 89e8256d..da29550b 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/package.nuspec @@ -2,23 +2,21 @@ Microsoft.TestPlatform.TestHost - 17.4.0 - Microsoft.TestPlatform.TestHost + 17.7.2 Microsoft - Microsoft true LICENSE_NET.txt https://aka.ms/deprecateLicenseUrl Icon.png - https://github.com/microsoft/vstest/ - http://go.microsoft.com/fwlink/?LinkID=288859 + https://github.com/microsoft/vstest Testplatform host executes the test using specified adapter. © Microsoft Corporation. All rights reserved. vstest visual-studio unittest testplatform mstest microsoft test testing - + true + - + diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/project-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/project-LICENSE new file mode 100644 index 00000000..d859446c --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/project-LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) Microsoft Corporation + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/readme.md similarity index 56% rename from Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/readme.md index e4243974..fbb4fa11 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.4.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/readme.md @@ -1,15 +1,15 @@ -Microsoft.TestPlatform.TestHost [17.4.0](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.4.0) +Microsoft.TestPlatform.TestHost [17.7.2](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.7.2) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [ms-net-library](../../../../licenses/ms-net-library) -- package license: [Unknown]() +- package license: [ms-net-library]() , The license file is identical to the file from version 17.4.0. - repository license: [MIT](https://github.com/microsoft/vstest) -- project license: [MIT](https://github.com/microsoft/vstest/) +- project license: [MIT](https://github.com/microsoft/vstest) Description ----------- @@ -25,7 +25,7 @@ Dependencies 2 |Name|Version| |----------|:----| -|[Microsoft.TestPlatform.ObjectModel](../../../../packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0)|17.4.0| -|[Newtonsoft.Json](../../../../packages/nuget.org/newtonsoft.json/13.0.2)|13.0.2| +|[Microsoft.TestPlatform.ObjectModel](../../../../packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2)|17.7.2| +|[Newtonsoft.Json](../../../../packages/nuget.org/newtonsoft.json/13.0.1)|13.0.1| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/repository-LICENSE new file mode 100644 index 00000000..d859446c --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/repository-LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) Microsoft Corporation + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/microsoft.testplatform.testhost/17.7.2/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/index.json index 023f66fe..0eb6a2a4 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,14 +9,21 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", + "net8.0", "netstandard2.0" ], "Dependencies": [ + { + "Name": "System.Buffers", + "Version": "4.5.1" + }, + { + "Name": "System.Memory", + "Version": "4.5.4" + }, { "Name": "System.Security.AccessControl", "Version": "4.7.0" @@ -31,14 +39,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/readme.md index bf195d65..7ed602a2 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/4.7.0/readme.md @@ -3,12 +3,12 @@ Microsoft.Win32.Registry [4.7.0](https://www.nuget.org/packages/Microsoft.Win32. Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- @@ -28,11 +28,13 @@ Remarks no remarks -Dependencies 2 +Dependencies 4 ----------- |Name|Version| |----------|:----| +|[System.Buffers](../../../../packages/nuget.org/system.buffers/4.5.1)|4.5.1| +|[System.Memory](../../../../packages/nuget.org/system.memory/4.5.4)|4.5.4| |[System.Security.AccessControl](../../../../packages/nuget.org/system.security.accesscontrol/4.7.0)|4.7.0| |[System.Security.Principal.Windows](../../../../packages/nuget.org/system.security.principal.windows/4.7.0)|4.7.0| diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/index.json deleted file mode 100644 index bfd0f20b..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/index.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "License": { - "Code": "MIT", - "Status": "AutomaticallyApproved" - }, - "UsedBy": [ - { - "Name": "SqlDatabase", - "InternalOnly": true, - "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" - ], - "Dependencies": [ - { - "Name": "System.Security.AccessControl", - "Version": "5.0.0" - }, - { - "Name": "System.Security.Principal.Windows", - "Version": "5.0.0" - } - ] - } - ], - "Licenses": [ - { - "Subject": "package", - "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null - }, - { - "Subject": "repository", - "Code": "MIT", - "HRef": "git://github.com/dotnet/runtime", - "Description": null - }, - { - "Subject": "project", - "Code": "MIT", - "HRef": "https://github.com/dotnet/runtime", - "Description": null - } - ] -} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/package.nuspec deleted file mode 100644 index b90a7ea7..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/package.nuspec +++ /dev/null @@ -1,94 +0,0 @@ - - - - Microsoft.Win32.Registry - 5.0.0 - Microsoft.Win32.Registry - Microsoft - microsoft,dotnetframework - false - MIT - https://licenses.nuget.org/MIT - Icon.png - https://github.com/dotnet/runtime - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides support for accessing and modifying the Windows Registry. - -Commonly Used Types: -Microsoft.Win32.RegistryKey -Microsoft.Win32.Registry -Microsoft.Win32.RegistryValueKind -Microsoft.Win32.RegistryHive -Microsoft.Win32.RegistryView - -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/readme.md deleted file mode 100644 index a353f944..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/readme.md +++ /dev/null @@ -1,40 +0,0 @@ -Microsoft.Win32.Registry [5.0.0](https://www.nuget.org/packages/Microsoft.Win32.Registry/5.0.0) --------------------- - -Used by: SqlDatabase internal - -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://licenses.nuget.org/MIT) -- repository license: [MIT](git://github.com/dotnet/runtime) -- project license: [MIT](https://github.com/dotnet/runtime) - -Description ------------ -Provides support for accessing and modifying the Windows Registry. - -Commonly Used Types: -Microsoft.Win32.RegistryKey -Microsoft.Win32.Registry -Microsoft.Win32.RegistryValueKind -Microsoft.Win32.RegistryHive -Microsoft.Win32.RegistryView - -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 2 ------------ - -|Name|Version| -|----------|:----| -|[System.Security.AccessControl](../../../../packages/nuget.org/system.security.accesscontrol/5.0.0)|5.0.0| -|[System.Security.Principal.Windows](../../../../packages/nuget.org/system.security.principal.windows/5.0.0)|5.0.0| - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/index.json deleted file mode 100644 index 56922b42..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/index.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "License": { - "Code": "MIT", - "Status": "AutomaticallyApproved" - }, - "UsedBy": [ - { - "Name": "SqlDatabase", - "InternalOnly": false, - "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", - "netstandard2.0" - ] - } - ], - "Licenses": [ - { - "Subject": "package", - "Code": "MIT", - "HRef": "https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt", - "Description": null - }, - { - "Subject": "project", - "Code": "MIT", - "HRef": "https://github.com/PowerShell/PowerShell", - "Description": null - } - ] -} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/package-LICENSE.txt deleted file mode 100644 index b2f52a2b..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/package-LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/package.nuspec deleted file mode 100644 index 931c7132..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/package.nuspec +++ /dev/null @@ -1,23 +0,0 @@ - - - - Microsoft.WSMan.Runtime - 7.0.5 - Microsoft - Microsoft,PowerShell - true - https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt - https://github.com/PowerShell/PowerShell - https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_black_64.png?raw=true - Runtime for hosting PowerShell - © Microsoft Corporation. All rights reserved. - en-US - PowerShell - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/project-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/project-LICENSE.txt deleted file mode 100644 index b2f52a2b..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/project-LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/readme.md deleted file mode 100644 index 86985d2d..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/readme.md +++ /dev/null @@ -1,26 +0,0 @@ -Microsoft.WSMan.Runtime [7.0.5](https://www.nuget.org/packages/Microsoft.WSMan.Runtime/7.0.5) --------------------- - -Used by: SqlDatabase - -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt) -- project license: [MIT](https://github.com/PowerShell/PowerShell) - -Description ------------ -Runtime for hosting PowerShell - -Remarks ------------ -no remarks - - -Dependencies 0 ------------ - - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/package.nuspec b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/package.nuspec deleted file mode 100644 index 8c9564b2..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/package.nuspec +++ /dev/null @@ -1,24 +0,0 @@ - - - - Microsoft.WSMan.Runtime - 7.1.2 - Microsoft - Microsoft,PowerShell - false - MIT - https://licenses.nuget.org/MIT - Powershell_black_64.png - https://github.com/PowerShell/PowerShell - Runtime for hosting PowerShell - © Microsoft Corporation. All rights reserved. - en-US - PowerShell - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/project-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/project-LICENSE.txt deleted file mode 100644 index b2f52a2b..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/project-LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/readme.md deleted file mode 100644 index 50df30e6..00000000 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/readme.md +++ /dev/null @@ -1,26 +0,0 @@ -Microsoft.WSMan.Runtime [7.1.2](https://www.nuget.org/packages/Microsoft.WSMan.Runtime/7.1.2) --------------------- - -Used by: SqlDatabase - -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [MIT](https://github.com/PowerShell/PowerShell) - -Description ------------ -Runtime for hosting PowerShell - -Remarks ------------ -no remarks - - -Dependencies 0 ------------ - - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/index.json index f207f9ee..24450662 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", + "net8.0", "netstandard2.0" ] } @@ -21,14 +21,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/PowerShell/PowerShell", - "Description": null + "HRef": "https://github.com/PowerShell/PowerShell" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/readme.md index b17c9a95..17289c6e 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.2.0/readme.md @@ -3,7 +3,7 @@ Microsoft.WSMan.Runtime [7.2.0](https://www.nuget.org/packages/Microsoft.WSMan.R Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/index.json b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/index.json index f207f9ee..24450662 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", + "net8.0", "netstandard2.0" ] } @@ -21,14 +21,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/PowerShell/PowerShell", - "Description": null + "HRef": "https://github.com/PowerShell/PowerShell" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/readme.md b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/readme.md index aa252a5e..f1e29f3f 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.3.0/readme.md @@ -3,7 +3,7 @@ Microsoft.WSMan.Runtime [7.3.0](https://www.nuget.org/packages/Microsoft.WSMan.R Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/index.json b/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/index.json deleted file mode 100644 index a604858f..00000000 --- a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/index.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "License": { - "Code": "BSD-3-Clause", - "Status": "AutomaticallyApproved" - }, - "UsedBy": [ - { - "Name": "SqlDatabase", - "InternalOnly": true, - "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" - ], - "Dependencies": [ - { - "Name": "Castle.Core", - "Version": "5.1.0" - } - ] - } - ], - "Licenses": [ - { - "Subject": "package", - "Code": null, - "HRef": "https://raw.githubusercontent.com/moq/moq4/main/License.txt", - "Description": "License should be verified on https://raw.githubusercontent.com/moq/moq4/main/License.txt" - }, - { - "Subject": "repository", - "Code": null, - "HRef": "https://github.com/moq/moq4", - "Description": "License should be verified on https://github.com/moq/moq4" - }, - { - "Subject": "project", - "Code": null, - "HRef": "https://github.com/moq/moq4", - "Description": "License should be verified on https://github.com/moq/moq4" - } - ] -} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/package-License.txt b/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/package-License.txt deleted file mode 100644 index 048dc06e..00000000 --- a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/package-License.txt +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD, -and Contributors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/package.nuspec b/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/package.nuspec deleted file mode 100644 index 65a776d4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/package.nuspec +++ /dev/null @@ -1,34 +0,0 @@ - - - - Moq - 4.18.2 - Moq: an enjoyable mocking library - Daniel Cazzulino, kzu - https://raw.githubusercontent.com/moq/moq4/main/License.txt - moq.png - https://github.com/moq/moq4 - Moq is the most popular and friendly mocking framework for .NET. - -Built from https://github.com/moq/moq4/tree/c60833da6 - A changelog is available at https://github.com/moq/moq4/blob/main/CHANGELOG.md. - moq tdd mocking mocks unittesting agile unittest - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/readme.md b/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/readme.md deleted file mode 100644 index 5aedd54e..00000000 --- a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/readme.md +++ /dev/null @@ -1,32 +0,0 @@ -Moq [4.18.2](https://www.nuget.org/packages/Moq/4.18.2) --------------------- - -Used by: SqlDatabase internal - -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 - -License: [BSD-3-Clause](../../../../licenses/bsd-3-clause) - -- package license: [Unknown](https://raw.githubusercontent.com/moq/moq4/main/License.txt) , License should be verified on https://raw.githubusercontent.com/moq/moq4/main/License.txt -- repository license: [Unknown](https://github.com/moq/moq4) , License should be verified on https://github.com/moq/moq4 -- project license: [Unknown](https://github.com/moq/moq4) , License should be verified on https://github.com/moq/moq4 - -Description ------------ -Moq is the most popular and friendly mocking framework for .NET. - -Built from https://github.com/moq/moq4/tree/c60833da6 - -Remarks ------------ -no remarks - - -Dependencies 1 ------------ - -|Name|Version| -|----------|:----| -|[Castle.Core](../../../../packages/nuget.org/castle.core/5.1.0)|5.1.0| - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/index.json b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/index.json new file mode 100644 index 00000000..5a1530fd --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/index.json @@ -0,0 +1,45 @@ +{ + "Source": "https://api.nuget.org/v3/index.json", + "License": { + "Code": "BSD-3-Clause", + "Status": "AutomaticallyApproved" + }, + "UsedBy": [ + { + "Name": "SqlDatabase", + "InternalOnly": true, + "TargetFrameworks": [ + "netstandard2.0" + ], + "Dependencies": [ + { + "Name": "Castle.Core", + "Version": "5.1.1" + }, + { + "Name": "System.Threading.Tasks.Extensions", + "Version": "4.5.4" + } + ] + } + ], + "Licenses": [ + { + "Subject": "package", + "Code": "BSD-3-Clause", + "HRef": "https://licenses.nuget.org/BSD-3-Clause" + }, + { + "Subject": "repository", + "Code": null, + "HRef": "https://github.com/moq/moq", + "Description": "License code NOASSERTION" + }, + { + "Subject": "project", + "Code": null, + "HRef": "https://github.com/moq/moq", + "Description": "License code NOASSERTION" + } + ] +} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/package.nuspec b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/package.nuspec new file mode 100644 index 00000000..78b02cae --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/package.nuspec @@ -0,0 +1,36 @@ + + + + Moq + 4.20.69 + Moq: an enjoyable mocking library + Daniel Cazzulino, kzu + false + BSD-3-Clause + https://licenses.nuget.org/BSD-3-Clause + icon.png + readme.md + https://github.com/moq/moq + Moq is the most popular and friendly mocking framework for .NET. + https://github.com/moq/moq/blob/main/changelog.md + Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD, and Contributors. All rights reserved. + moq;tdd;mocking;mocks;unittesting;agile;unittest + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/project-License.txt b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/project-License.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/moq/4.18.2/project-License.txt rename to Build/third-party-libraries/packages/nuget.org/moq/4.20.69/project-License.txt diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/readme.md b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/readme.md new file mode 100644 index 00000000..0e4df030 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/readme.md @@ -0,0 +1,31 @@ +Moq [4.20.69](https://www.nuget.org/packages/Moq/4.20.69) +-------------------- + +Used by: SqlDatabase internal + +Target frameworks: netstandard2.0 + +License: [BSD-3-Clause](../../../../licenses/bsd-3-clause) + +- package license: [BSD-3-Clause](https://licenses.nuget.org/BSD-3-Clause) +- repository license: [Unknown](https://github.com/moq/moq) , License code NOASSERTION +- project license: [Unknown](https://github.com/moq/moq) , License code NOASSERTION + +Description +----------- +Moq is the most popular and friendly mocking framework for .NET. + +Remarks +----------- +no remarks + + +Dependencies 2 +----------- + +|Name|Version| +|----------|:----| +|[Castle.Core](../../../../packages/nuget.org/castle.core/5.1.1)|5.1.1| +|[System.Threading.Tasks.Extensions](../../../../packages/nuget.org/system.threading.tasks.extensions/4.5.4)|4.5.4| + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/remarks.md b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/remarks.md rename to Build/third-party-libraries/packages/nuget.org/moq/4.20.69/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/repository-License.txt b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/repository-License.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/moq/4.18.2/repository-License.txt rename to Build/third-party-libraries/packages/nuget.org/moq/4.20.69/repository-License.txt diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/moq/4.20.69/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.0.5/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/moq/4.20.69/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/index.json b/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/index.json index 21b914d7..df6d7367 100644 --- a/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/index.json +++ b/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,12 +9,21 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" + ], + "Dependencies": [ + { + "Name": "System.Buffers", + "Version": "4.4.0" + }, + { + "Name": "System.Memory", + "Version": "4.5.0" + }, + { + "Name": "System.Threading.Tasks.Extensions", + "Version": "4.3.0" + } ] } ], @@ -21,20 +31,17 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/mysql-net/MySqlConnector.git", - "Description": null + "HRef": "https://github.com/mysql-net/MySqlConnector.git" }, { "Subject": "project", "Code": null, - "HRef": "https://mysqlconnector.net/", - "Description": "License should be verified on https://mysqlconnector.net/" + "HRef": "https://mysqlconnector.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/readme.md b/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/readme.md index de5afb3d..fa960705 100644 --- a/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/readme.md @@ -3,13 +3,13 @@ MySqlConnector [1.3.10](https://www.nuget.org/packages/MySqlConnector/1.3.10) Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) - repository license: [MIT](https://github.com/mysql-net/MySqlConnector.git) -- project license: [Unknown](https://mysqlconnector.net/) , License should be verified on https://mysqlconnector.net/ +- project license: [Unknown](https://mysqlconnector.net/) Description ----------- @@ -20,8 +20,13 @@ Remarks no remarks -Dependencies 0 +Dependencies 3 ----------- +|Name|Version| +|----------|:----| +|[System.Buffers](../../../../packages/nuget.org/system.buffers/4.4.0)|4.4.0| +|[System.Memory](../../../../packages/nuget.org/system.memory/4.5.0)|4.5.0| +|[System.Threading.Tasks.Extensions](../../../../packages/nuget.org/system.threading.tasks.extensions/4.3.0)|4.3.0| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/repository-LICENSE index a6b033c2..11f3e7c6 100644 --- a/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/repository-LICENSE +++ b/Build/third-party-libraries/packages/nuget.org/mysqlconnector/1.3.10/repository-LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2021 Bradley Grainger +Copyright (c) 2016-2023 Bradley Grainger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/index.json b/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/index.json index d6322f13..e616c4c1 100644 --- a/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/index.json +++ b/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", + "net8.0", "netstandard2.0" ] } @@ -21,8 +21,7 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/standard/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/standard/blob/master/LICENSE.TXT" }, { "Subject": "project", diff --git a/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/readme.md b/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/readme.md index 60dff056..54e2194d 100644 --- a/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/netstandard.library/2.0.3/readme.md @@ -3,7 +3,7 @@ NETStandard.Library [2.0.3](https://www.nuget.org/packages/NETStandard.Library/2 Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/index.json b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/index.json similarity index 59% rename from Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/index.json rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/index.json index 04920ef7..0bd3aac3 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.codecoverage/17.4.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/index.json @@ -1,6 +1,7 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { - "Code": "ms-net-library", + "Code": "MIT", "Status": "AutomaticallyApproved" }, "UsedBy": [ @@ -8,32 +9,28 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ] } ], "Licenses": [ { "Subject": "package", - "Code": null, - "HRef": null, - "Description": null + "Code": "MIT", + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest", - "Description": null + "HRef": "https://github.com/JamesNK/Newtonsoft.Json" }, { "Subject": "project", - "Code": "MIT", - "HRef": "https://github.com/microsoft/vstest/", - "Description": null + "Code": null, + "HRef": "https://www.newtonsoft.com/json" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/package-LICENSE.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/package-LICENSE.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/package-LICENSE.md rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/package-LICENSE.md diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/package.nuspec b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/package.nuspec new file mode 100644 index 00000000..23ab73b3 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/package.nuspec @@ -0,0 +1,39 @@ + + + + Newtonsoft.Json + 13.0.1 + Json.NET + James Newton-King + false + MIT + https://licenses.nuget.org/MIT + packageIcon.png + https://www.newtonsoft.com/json + Json.NET is a popular high-performance JSON framework for .NET + Copyright © James Newton-King 2008 + json + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/readme.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/readme.md similarity index 60% rename from Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/readme.md rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/readme.md index af6f1f81..d7394d25 100644 --- a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/readme.md @@ -1,15 +1,15 @@ -Newtonsoft.Json [13.0.2](https://www.nuget.org/packages/Newtonsoft.Json/13.0.2) +Newtonsoft.Json [13.0.1](https://www.nuget.org/packages/Newtonsoft.Json/13.0.1) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) - repository license: [MIT](https://github.com/JamesNK/Newtonsoft.Json) -- project license: [Unknown](https://www.newtonsoft.com/json) , License should be verified on https://www.newtonsoft.com/json +- project license: [Unknown](https://www.newtonsoft.com/json) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/remarks.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/remarks.md rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/repository-LICENSE.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/repository-LICENSE.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/repository-LICENSE.md rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/repository-LICENSE.md diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.1/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/index.json b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/index.json deleted file mode 100644 index fd77bf70..00000000 --- a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/index.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "License": { - "Code": "MIT", - "Status": "AutomaticallyApproved" - }, - "UsedBy": [ - { - "Name": "SqlDatabase", - "InternalOnly": true, - "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" - ] - } - ], - "Licenses": [ - { - "Subject": "package", - "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null - }, - { - "Subject": "repository", - "Code": "MIT", - "HRef": "https://github.com/JamesNK/Newtonsoft.Json", - "Description": null - }, - { - "Subject": "project", - "Code": null, - "HRef": "https://www.newtonsoft.com/json", - "Description": "License should be verified on https://www.newtonsoft.com/json" - } - ] -} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/index.json b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/index.json similarity index 58% rename from Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/index.json rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/index.json index 3a4ffb5d..0bd3aac3 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ] } ], @@ -20,20 +20,17 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/dotnet/runtime", - "Description": null + "HRef": "https://github.com/JamesNK/Newtonsoft.Json" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://www.newtonsoft.com/json" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/package-LICENSE.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/package-LICENSE.md new file mode 100644 index 00000000..dfaadbe4 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/package-LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2007 James Newton-King + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/package.nuspec b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/package.nuspec similarity index 96% rename from Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/package.nuspec index 9ef2e1f7..97d1d959 100644 --- a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/package.nuspec @@ -2,7 +2,7 @@ Newtonsoft.Json - 13.0.2 + 13.0.3 Json.NET James Newton-King MIT @@ -14,7 +14,7 @@ Json.NET is a popular high-performance JSON framework for .NET Copyright © James Newton-King 2008 json - + diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/readme.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/readme.md new file mode 100644 index 00000000..3ee80dad --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/readme.md @@ -0,0 +1,27 @@ +Newtonsoft.Json [13.0.3](https://www.nuget.org/packages/Newtonsoft.Json/13.0.3) +-------------------- + +Used by: SqlDatabase internal + +Target frameworks: net472, net6.0, net7.0, net8.0 + +License: [MIT](../../../../licenses/mit) + +- package license: [MIT](https://licenses.nuget.org/MIT) +- repository license: [MIT](https://github.com/JamesNK/Newtonsoft.Json) +- project license: [Unknown](https://www.newtonsoft.com/json) + +Description +----------- +Json.NET is a popular high-performance JSON framework for .NET + +Remarks +----------- +no remarks + + +Dependencies 0 +----------- + + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/remarks.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/moq/4.18.2/remarks.md rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/repository-LICENSE.md b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/repository-LICENSE.md new file mode 100644 index 00000000..dfaadbe4 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/repository-LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2007 James Newton-King + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/moq/4.18.2/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/moq/4.18.2/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.3/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/index.json b/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/index.json index 467268bf..0d56e40d 100644 --- a/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/index.json +++ b/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "PostgreSQL", "Status": "AutomaticallyApproved" @@ -8,17 +9,20 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ], "Dependencies": [ + { + "Name": "System.Memory", + "Version": "4.5.3" + }, { "Name": "System.Runtime.CompilerServices.Unsafe", "Version": "4.5.2" + }, + { + "Name": "System.Threading.Tasks.Extensions", + "Version": "4.5.2" } ] } @@ -27,20 +31,17 @@ { "Subject": "package", "Code": "PostgreSQL", - "HRef": "https://licenses.nuget.org/PostgreSQL", - "Description": null + "HRef": "https://licenses.nuget.org/PostgreSQL" }, { "Subject": "repository", "Code": "PostgreSQL", - "HRef": "git://github.com/npgsql/npgsql", - "Description": null + "HRef": "git://github.com/npgsql/npgsql" }, { "Subject": "project", "Code": null, - "HRef": "http://www.npgsql.org/", - "Description": "License should be verified on http://www.npgsql.org/" + "HRef": "http://www.npgsql.org/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/readme.md b/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/readme.md index 75475b97..e99ba1c0 100644 --- a/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/readme.md @@ -3,13 +3,13 @@ Npgsql [4.0.11](https://www.nuget.org/packages/Npgsql/4.0.11) Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: netstandard2.0 License: [PostgreSQL](../../../../licenses/postgresql) - package license: [PostgreSQL](https://licenses.nuget.org/PostgreSQL) - repository license: [PostgreSQL](git://github.com/npgsql/npgsql) -- project license: [Unknown](http://www.npgsql.org/) , License should be verified on http://www.npgsql.org/ +- project license: [Unknown](http://www.npgsql.org/) Description ----------- @@ -20,11 +20,13 @@ Remarks no remarks -Dependencies 1 +Dependencies 3 ----------- |Name|Version| |----------|:----| +|[System.Memory](../../../../packages/nuget.org/system.memory/4.5.3)|4.5.3| |[System.Runtime.CompilerServices.Unsafe](../../../../packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2)|4.5.2| +|[System.Threading.Tasks.Extensions](../../../../packages/nuget.org/system.threading.tasks.extensions/4.5.2)|4.5.2| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/repository-LICENSE index b102b0e3..efec310c 100644 --- a/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/repository-LICENSE +++ b/Build/third-party-libraries/packages/nuget.org/npgsql/4.0.11/repository-LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2002-2021, Npgsql +Copyright (c) 2002-2023, Npgsql Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement diff --git a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/index.json b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/index.json similarity index 59% rename from Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/index.json rename to Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/index.json index e2d3fe32..2809b998 100644 --- a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "Apache-2.0", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ] } ], @@ -20,20 +20,18 @@ { "Subject": "package", "Code": "Apache-2.0", - "HRef": "https://licenses.nuget.org/Apache-2.0", - "Description": null + "HRef": "https://licenses.nuget.org/Apache-2.0" }, { "Subject": "repository", "Code": null, "HRef": "https://github.com/NuGet/NuGet.Client", - "Description": "License should be verified on https://github.com/NuGet/NuGet.Client" + "Description": "License code NOASSERTION" }, { "Subject": "project", "Code": null, - "HRef": "https://aka.ms/nugetprj", - "Description": "License should be verified on https://aka.ms/nugetprj" + "HRef": "https://aka.ms/nugetprj" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/package.nuspec similarity index 86% rename from Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/package.nuspec index 5cb721d9..811d1c0d 100644 --- a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/package.nuspec @@ -2,20 +2,20 @@ NuGet.Frameworks - 5.11.0 + 6.5.0 Microsoft true Apache-2.0 https://licenses.nuget.org/Apache-2.0 icon.png + README.md https://aka.ms/nugetprj NuGet's understanding of target frameworks. © Microsoft Corporation. All rights reserved. nuget true - + - diff --git a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/readme.md b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/readme.md similarity index 55% rename from Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/readme.md index d812d5ac..6d535493 100644 --- a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/readme.md @@ -1,15 +1,15 @@ -NuGet.Frameworks [5.11.0](https://www.nuget.org/packages/NuGet.Frameworks/5.11.0) +NuGet.Frameworks [6.5.0](https://www.nuget.org/packages/NuGet.Frameworks/6.5.0) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [Apache-2.0](../../../../licenses/apache-2.0) - package license: [Apache-2.0](https://licenses.nuget.org/Apache-2.0) -- repository license: [Unknown](https://github.com/NuGet/NuGet.Client) , License should be verified on https://github.com/NuGet/NuGet.Client -- project license: [Unknown](https://aka.ms/nugetprj) , License should be verified on https://aka.ms/nugetprj +- repository license: [Unknown](https://github.com/NuGet/NuGet.Client) , License code NOASSERTION +- project license: [Unknown](https://aka.ms/nugetprj) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/remarks.md b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/remarks.md rename to Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/repository-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/repository-LICENSE.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/repository-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/repository-LICENSE.txt diff --git a/Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/newtonsoft.json/13.0.2/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/nuget.frameworks/6.5.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/index.json b/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/index.json deleted file mode 100644 index 5b0b9719..00000000 --- a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/index.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "License": { - "Code": "MIT", - "Status": "AutomaticallyApproved" - }, - "UsedBy": [ - { - "Name": "SqlDatabase", - "InternalOnly": true, - "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" - ] - } - ], - "Licenses": [ - { - "Subject": "package", - "Code": null, - "HRef": null, - "Description": null - }, - { - "Subject": "repository", - "Code": "MIT", - "HRef": "https://github.com/nunit/nunit", - "Description": null - }, - { - "Subject": "project", - "Code": null, - "HRef": "https://nunit.org/", - "Description": "License should be verified on https://nunit.org/" - } - ] -} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/index.json b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/index.json similarity index 58% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/index.json rename to Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/index.json index cf67483a..27b50717 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ] } ], @@ -20,20 +20,18 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "LICENSE.txt", + "Description": "The license file is identical to the repository license file." }, { "Subject": "repository", "Code": "MIT", - "HRef": "git://github.com/dotnet/runtime", - "Description": null + "HRef": "https://github.com/nunit/nunit" }, { "Subject": "project", - "Code": "MIT", - "HRef": "https://github.com/dotnet/runtime", - "Description": null + "Code": null, + "HRef": "https://nunit.org/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/package-LICENSE.txt similarity index 95% rename from Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/package-LICENSE.txt index ab7da19e..7eb103cf 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/package-LICENSE.txt +++ b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/package-LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2022 Charlie Poole, Rob Prouse +Copyright (c) 2023 Charlie Poole, Rob Prouse Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/package.nuspec b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/package.nuspec similarity index 94% rename from Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/package.nuspec index 70a874bf..13489c22 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/package.nuspec @@ -2,7 +2,7 @@ NUnit - 3.13.3 + 3.14.0 NUnit Charlie Poole, Rob Prouse Charlie Poole, Rob Prouse @@ -10,6 +10,7 @@ LICENSE.txt https://aka.ms/deprecateLicenseUrl icon.png + README.md https://nunit.org/ https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible. @@ -21,7 +22,7 @@ Supported platforms: - .NET Standard 2.0+ NUnit is a unit-testing framework for all .NET languages with a strong TDD focus. This package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly. - Copyright (c) 2022 Charlie Poole, Rob Prouse + Copyright (c) 2023 Charlie Poole, Rob Prouse en-US nunit test testing tdd framework fluent assert theory plugin addin diff --git a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/readme.md b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/readme.md similarity index 74% rename from Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/readme.md rename to Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/readme.md index b788b316..0e505383 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/readme.md @@ -1,15 +1,15 @@ -NUnit [3.13.3](https://www.nuget.org/packages/NUnit/3.13.3) +NUnit [3.14.0](https://www.nuget.org/packages/NUnit/3.14.0) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [MIT](../../../../licenses/mit) -- package license: [Unknown]() +- package license: [MIT]() , The license file is identical to the repository license file. - repository license: [MIT](https://github.com/nunit/nunit) -- project license: [Unknown](https://nunit.org/) , License should be verified on https://nunit.org/ +- project license: [Unknown](https://nunit.org/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/repository-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/repository-LICENSE.txt similarity index 95% rename from Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/repository-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/repository-LICENSE.txt index 29f0e2ea..7eb103cf 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/repository-LICENSE.txt +++ b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/repository-LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2021 Charlie Poole, Rob Prouse +Copyright (c) 2023 Charlie Poole, Rob Prouse Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/nuget.frameworks/5.11.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/nunit/3.14.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/index.json b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/index.json similarity index 59% rename from Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/index.json rename to Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/index.json index d8aa9087..0075237a 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/index.json +++ b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ] } ], @@ -20,20 +20,17 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/nunit/nunit3-vs-adapter", - "Description": null + "HRef": "https://github.com/nunit/nunit3-vs-adapter" }, { "Subject": "project", "Code": null, - "HRef": "https://docs.nunit.org/articles/vs-test-adapter/Index.html", - "Description": "License should be verified on https://docs.nunit.org/articles/vs-test-adapter/Index.html" + "HRef": "https://docs.nunit.org/articles/vs-test-adapter/Index.html" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/package.nuspec b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/package.nuspec similarity index 82% rename from Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/package.nuspec index b703abf0..bd455332 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/package.nuspec @@ -2,21 +2,22 @@ NUnit3TestAdapter - 4.3.1 + 4.5.0 NUnit3 Test Adapter for Visual Studio and DotNet Charlie Poole, Terje Sandstrom false MIT https://licenses.nuget.org/MIT + nunit_256.png + docs\README.md https://docs.nunit.org/articles/vs-test-adapter/Index.html - https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png - The NUnit3 TestAdapter for Visual Studio, all versions from 2012 and onwards, and DotNet (incl. .Net core). + The NUnit3 TestAdapter for Visual Studio, all versions from 2012 and onwards, and DotNet (incl. .Net core), versions .net framework 4.6.2 or higher, .net core 3.1, .net 5 or higher. Note that this package ONLY contains the adapter, not the NUnit framework. For VS 2017 and forward, you should add this package to every test project in your solution. (Earlier versions only require a single adapter package per solution.) NUnit3 adapter for running tests in Visual Studio and DotNet. Works with NUnit 3.x, use the NUnit 2 adapter for 2.x tests. See https://docs.nunit.org/articles/vs-test-adapter/Adapter-Release-Notes.html - Copyright (c) 2011-2021 Charlie Poole, 2014-2022 Terje Sandstrom + Copyright (c) 2011-2021 Charlie Poole, 2014-2023 Terje Sandstrom en-US test visualstudio testadapter nunit nunit3 dotnet diff --git a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/readme.md b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/readme.md similarity index 70% rename from Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/readme.md rename to Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/readme.md index bcec9301..85936e56 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/readme.md @@ -1,19 +1,19 @@ -NUnit3TestAdapter [4.3.1](https://www.nuget.org/packages/NUnit3TestAdapter/4.3.1) +NUnit3TestAdapter [4.5.0](https://www.nuget.org/packages/NUnit3TestAdapter/4.5.0) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) - repository license: [MIT](https://github.com/nunit/nunit3-vs-adapter) -- project license: [Unknown](https://docs.nunit.org/articles/vs-test-adapter/Index.html) , License should be verified on https://docs.nunit.org/articles/vs-test-adapter/Index.html +- project license: [Unknown](https://docs.nunit.org/articles/vs-test-adapter/Index.html) Description ----------- -The NUnit3 TestAdapter for Visual Studio, all versions from 2012 and onwards, and DotNet (incl. .Net core). +The NUnit3 TestAdapter for Visual Studio, all versions from 2012 and onwards, and DotNet (incl. .Net core), versions .net framework 4.6.2 or higher, .net core 3.1, .net 5 or higher. Note that this package ONLY contains the adapter, not the NUnit framework. For VS 2017 and forward, you should add this package to every test project in your solution. (Earlier versions only require a single adapter package per solution.) diff --git a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/remarks.md b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/remarks.md rename to Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/repository-LICENSE b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/repository-LICENSE similarity index 94% rename from Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/repository-LICENSE rename to Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/repository-LICENSE index 3302bf8b..6783f2bb 100644 --- a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/repository-LICENSE +++ b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/repository-LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2011-2020 Charlie Poole, 2014-2022 Terje Sandstrom +Copyright (c) 2011-2020 Charlie Poole, 2014-2023 Terje Sandstrom Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/nunit/3.13.3/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.5.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/index.json b/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/index.json index 13bf1f8a..7ea9e2d3 100644 --- a/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,13 +9,11 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", - "netstandard2.0", - "net472" + "net8.0", + "netstandard2.0" ] } ], @@ -22,14 +21,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt", - "Description": null + "HRef": "https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/PowerShell/PowerShellStandard", - "Description": null + "HRef": "https://github.com/PowerShell/PowerShellStandard" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/readme.md b/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/readme.md index 06c7815f..3c701fff 100644 --- a/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/powershellstandard.library/5.1.0/readme.md @@ -3,7 +3,7 @@ PowerShellStandard.Library [5.1.0](https://www.nuget.org/packages/PowerShellStan Used by: SqlDatabase -Target frameworks: net452, net472, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/project-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/project-LICENSE.txt deleted file mode 100644 index 2b31d119..00000000 --- a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/project-LICENSE.txt +++ /dev/null @@ -1,24 +0,0 @@ -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the names of the copyright holders nor the names of - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -[ http://www.opensource.org/licenses/bsd-license.php ] \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/readme.md b/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/readme.md deleted file mode 100644 index 34644969..00000000 --- a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/readme.md +++ /dev/null @@ -1,31 +0,0 @@ -Shouldly [4.1.0](https://www.nuget.org/packages/Shouldly/4.1.0) --------------------- - -Used by: SqlDatabase internal - -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 - -License: [BSD-2-Clause](../../../../licenses/bsd-2-clause) - -- package license: [BSD-2-Clause](https://licenses.nuget.org/BSD-2-Clause) -- repository license: [Unknown](https://github.com/shouldly/shouldly.git) , License should be verified on https://github.com/shouldly/shouldly.git -- project license: [Unknown](https://github.com/shouldly/shouldly) , License should be verified on https://github.com/shouldly/shouldly - -Description ------------ -Shouldly - Assertion framework for .NET. The way asserting *Should* be - -Remarks ------------ -no remarks - - -Dependencies 2 ------------ - -|Name|Version| -|----------|:----| -|[DiffEngine](../../../../packages/nuget.org/diffengine/10.0.0)|10.0.0| -|[EmptyFiles](../../../../packages/nuget.org/emptyfiles/2.8.0)|2.8.0| - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/index.json b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/index.json similarity index 56% rename from Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/index.json rename to Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/index.json index 061e9015..89f9ce8c 100644 --- a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "BSD-2-Clause", "Status": "AutomaticallyApproved" @@ -8,20 +9,20 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" ], "Dependencies": [ { "Name": "DiffEngine", - "Version": "10.0.0" + "Version": "11.3.0" }, { "Name": "EmptyFiles", - "Version": "2.8.0" + "Version": "4.4.0" + }, + { + "Name": "Microsoft.CSharp", + "Version": "4.7.0" } ] } @@ -30,20 +31,18 @@ { "Subject": "package", "Code": "BSD-2-Clause", - "HRef": "https://licenses.nuget.org/BSD-2-Clause", - "Description": null + "HRef": "https://licenses.nuget.org/BSD-2-Clause" }, { "Subject": "repository", "Code": null, "HRef": "https://github.com/shouldly/shouldly.git", - "Description": "License should be verified on https://github.com/shouldly/shouldly.git" + "Description": "License code NOASSERTION" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/shouldly/shouldly", - "Description": "License should be verified on https://github.com/shouldly/shouldly" + "HRef": "https://shouldly.org/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/package.nuspec similarity index 62% rename from Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/package.nuspec index 9942b38e..45d46151 100644 --- a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/package.nuspec @@ -2,20 +2,24 @@ Shouldly - 4.1.0 + 4.2.1 Jake Ginnivan, Joseph Woodward, Simon Cropp BSD-2-Clause https://licenses.nuget.org/BSD-2-Clause assets/logo_128x128.png - https://github.com/shouldly/shouldly + https://shouldly.org/ Shouldly - Assertion framework for .NET. The way asserting *Should* be - https://github.com/shouldly/releases/tag/4.1.0 + https://github.com/shouldly/releases/tag/4.2.1 test unit testing TDD AAA should testunit rspec assert assertion framework - + + + + + - - + + diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/readme.md b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/readme.md new file mode 100644 index 00000000..1fd52e51 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/readme.md @@ -0,0 +1,32 @@ +Shouldly [4.2.1](https://www.nuget.org/packages/Shouldly/4.2.1) +-------------------- + +Used by: SqlDatabase internal + +Target frameworks: netstandard2.0 + +License: [BSD-2-Clause](../../../../licenses/bsd-2-clause) + +- package license: [BSD-2-Clause](https://licenses.nuget.org/BSD-2-Clause) +- repository license: [Unknown](https://github.com/shouldly/shouldly.git) , License code NOASSERTION +- project license: [Unknown](https://shouldly.org/) + +Description +----------- +Shouldly - Assertion framework for .NET. The way asserting *Should* be + +Remarks +----------- +no remarks + + +Dependencies 3 +----------- + +|Name|Version| +|----------|:----| +|[DiffEngine](../../../../packages/nuget.org/diffengine/11.3.0)|11.3.0| +|[EmptyFiles](../../../../packages/nuget.org/emptyfiles/4.4.0)|4.4.0| +|[Microsoft.CSharp](../../../../packages/nuget.org/microsoft.csharp/4.7.0)|4.7.0| + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/remarks.md b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/remarks.md rename to Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/repository-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/repository-LICENSE.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/repository-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/repository-LICENSE.txt diff --git a/Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/nunit3testadapter/4.3.1/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/shouldly/4.2.1/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/index.json b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/index.json similarity index 68% rename from Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/index.json rename to Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/index.json index 64ec2c6e..b4213aec 100644 --- a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/index.json +++ b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,13 +9,11 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", - "netstandard2.0", - "net472" + "net8.0", + "netstandard2.0" ] } ], @@ -22,14 +21,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": "MIT", - "HRef": "https://github.com/DotNetAnalyzers/StyleCopAnalyzers", - "Description": null + "HRef": "https://github.com/DotNetAnalyzers/StyleCopAnalyzers" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/package-LICENSE b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/package-LICENSE similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/package-LICENSE rename to Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/package-LICENSE diff --git a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/package.nuspec b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/package.nuspec similarity index 92% rename from Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/package.nuspec index d0148958..9fd61111 100644 --- a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/package.nuspec @@ -2,7 +2,7 @@ StyleCop.Analyzers.Unstable - 1.2.0.435 + 1.2.0.507 StyleCop.Analyzers.Unstable Sam Harwell et. al. Sam Harwell @@ -12,7 +12,7 @@ https://licenses.nuget.org/MIT https://github.com/DotNetAnalyzers/StyleCopAnalyzers An implementation of StyleCop's rules using Roslyn analyzers and code fixes - https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases/1.2.0-beta.435 + https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases/1.2.0-beta.507 Copyright 2015 Tunnel Vision Laboratories, LLC StyleCop DotNetAnalyzers Roslyn Diagnostic Analyzer diff --git a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/project-LICENSE b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/project-LICENSE similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/project-LICENSE rename to Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/project-LICENSE diff --git a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/readme.md b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/readme.md similarity index 68% rename from Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/readme.md rename to Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/readme.md index 207ab7dc..bc613e4a 100644 --- a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/readme.md @@ -1,9 +1,9 @@ -StyleCop.Analyzers.Unstable [1.2.0.435](https://www.nuget.org/packages/StyleCop.Analyzers.Unstable/1.2.0.435) +StyleCop.Analyzers.Unstable [1.2.0.507](https://www.nuget.org/packages/StyleCop.Analyzers.Unstable/1.2.0.507) -------------------- Used by: SqlDatabase internal -Target frameworks: net452, net472, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/shouldly/4.1.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/index.json index 79494e46..082ffec6 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,6 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ] } @@ -21,14 +17,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/readme.md index 914652b9..dfd93595 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.4.0/readme.md @@ -3,12 +3,12 @@ System.Buffers [4.4.0](https://www.nuget.org/packages/System.Buffers/4.4.0) Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/index.json b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/index.json index 79494e46..32f97a40 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", + "net472", "netstandard2.0" ] } @@ -21,14 +18,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/readme.md b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/readme.md index e50f8eb9..710959a7 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.buffers/4.5.1/readme.md @@ -3,12 +3,12 @@ System.Buffers [4.5.1](https://www.nuget.org/packages/System.Buffers/4.5.1) Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/index.json b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/index.json similarity index 54% rename from Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/index.json rename to Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/index.json index f207f9ee..0502ba77 100644 --- a/Build/third-party-libraries/packages/nuget.org/microsoft.wsman.runtime/7.1.2/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -6,13 +7,8 @@ "UsedBy": [ { "Name": "SqlDatabase", - "InternalOnly": false, + "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ] } @@ -21,14 +17,17 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { - "Subject": "project", + "Subject": "repository", "Code": "MIT", - "HRef": "https://github.com/PowerShell/PowerShell", - "Description": null + "HRef": "https://github.com/dotnet/runtime" + }, + { + "Subject": "project", + "Code": null, + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/project-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/project-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/package.nuspec similarity index 50% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/package.nuspec index 81a09f5b..d6e3148b 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/package.nuspec @@ -1,37 +1,28 @@  - - + + System.CodeDom - 5.0.0 - System.CodeDom + 6.0.0 Microsoft - microsoft,dotnetframework - false MIT https://licenses.nuget.org/MIT Icon.png - https://github.com/dotnet/runtime - http://go.microsoft.com/fwlink/?LinkID=288859 + https://dot.net/ Provides types that can be used to model the structure of a source code document and to output source code for that model in a supported language. Commonly Used Types: System.CodeDom.CodeObject System.CodeDom.Compiler.CodeDomProvider Microsoft.CSharp.CSharpCodeProvider -Microsoft.VisualBasic.VBCodeProvider - -When using NuGet 3.x this package requires at least version 3.4. +Microsoft.VisualBasic.VBCodeProvider https://go.microsoft.com/fwlink/?LinkID=799421 © Microsoft Corporation. All rights reserved. true - + + - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/readme.md similarity index 63% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/readme.md index 296795bc..302268e4 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/readme.md @@ -1,15 +1,15 @@ -System.CodeDom [5.0.0](https://www.nuget.org/packages/System.CodeDom/5.0.0) +System.CodeDom [6.0.0](https://www.nuget.org/packages/System.CodeDom/6.0.0) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- repository license: [MIT](git://github.com/dotnet/runtime) -- project license: [MIT](https://github.com/dotnet/runtime) +- repository license: [MIT](https://github.com/dotnet/runtime) +- project license: [Unknown](https://dot.net/) Description ----------- @@ -20,8 +20,6 @@ System.CodeDom.CodeObject System.CodeDom.Compiler.CodeDomProvider Microsoft.CSharp.CSharpCodeProvider Microsoft.VisualBasic.VBCodeProvider - -When using NuGet 3.x this package requires at least version 3.4. Remarks ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/repository-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/repository-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/microsoft.win32.registry/5.0.0/repository-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/repository-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.codedom/6.0.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/package.nuspec deleted file mode 100644 index 57097461..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/package.nuspec +++ /dev/null @@ -1,59 +0,0 @@ - - - - System.Configuration.ConfigurationManager - 4.5.0 - System.Configuration.ConfigurationManager - Microsoft - microsoft,dotnetframework - false - https://github.com/dotnet/corefx/blob/master/LICENSE.TXT - https://dot.net/ - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides types that support using configuration files. - -Commonly Used Types: -System.Configuration.Configuration -System.Configuration.ConfigurationManager - -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/readme.md deleted file mode 100644 index cccab090..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/readme.md +++ /dev/null @@ -1,37 +0,0 @@ -System.Configuration.ConfigurationManager [4.5.0](https://www.nuget.org/packages/System.Configuration.ConfigurationManager/4.5.0) --------------------- - -Used by: SqlDatabase - -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ - -Description ------------ -Provides types that support using configuration files. - -Commonly Used Types: -System.Configuration.Configuration -System.Configuration.ConfigurationManager - -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 2 ------------ - -|Name|Version| -|----------|:----| -|[System.Security.Cryptography.ProtectedData](../../../../packages/nuget.org/system.security.cryptography.protecteddata/4.5.0)|4.5.0| -|[System.Security.Permissions](../../../../packages/nuget.org/system.security.permissions/4.5.0)|4.5.0| - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/index.json b/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/index.json index b55c8262..8533ff19 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", + "net8.0", "netstandard2.0" ], "Dependencies": [ @@ -20,9 +20,25 @@ "Name": "Microsoft.Win32.Registry", "Version": "4.7.0" }, + { + "Name": "System.Buffers", + "Version": "4.5.1" + }, + { + "Name": "System.Diagnostics.DiagnosticSource", + "Version": "4.7.0" + }, + { + "Name": "System.Memory", + "Version": "4.5.4" + }, { "Name": "System.Security.Principal.Windows", "Version": "4.7.0" + }, + { + "Name": "System.Text.Encoding.CodePages", + "Version": "4.7.0" } ] } @@ -31,14 +47,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/readme.md b/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/readme.md index 67e11c15..f3bdcc99 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.data.sqlclient/4.8.5/readme.md @@ -3,12 +3,12 @@ System.Data.SqlClient [4.8.5](https://www.nuget.org/packages/System.Data.SqlClie Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- @@ -32,12 +32,16 @@ Remarks no remarks -Dependencies 2 +Dependencies 6 ----------- |Name|Version| |----------|:----| |[Microsoft.Win32.Registry](../../../../packages/nuget.org/microsoft.win32.registry/4.7.0)|4.7.0| +|[System.Buffers](../../../../packages/nuget.org/system.buffers/4.5.1)|4.5.1| +|[System.Diagnostics.DiagnosticSource](../../../../packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0)|4.7.0| +|[System.Memory](../../../../packages/nuget.org/system.memory/4.5.4)|4.5.4| |[System.Security.Principal.Windows](../../../../packages/nuget.org/system.security.principal.windows/4.7.0)|4.7.0| +|[System.Text.Encoding.CodePages](../../../../packages/nuget.org/system.text.encoding.codepages/4.7.0)|4.7.0| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/index.json index 5d326378..4d4b6b37 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", + "net472", "netstandard2.0" ], "Dependencies": [ @@ -27,14 +24,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/readme.md index 90f71dd7..968c953e 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0/readme.md @@ -3,12 +3,12 @@ System.Diagnostics.DiagnosticSource [4.7.0](https://www.nuget.org/packages/Syste Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/index.json index 89590aa6..7ab0c08d 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,20 +9,12 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" ], "Dependencies": [ - { - "Name": "Microsoft.Win32.Registry", - "Version": "5.0.0" - }, { "Name": "System.Security.Principal.Windows", - "Version": "5.0.0" + "Version": "4.7.0" } ] } @@ -30,14 +23,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/readme.md index 608ab741..f6a9054b 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/readme.md @@ -3,12 +3,12 @@ System.Diagnostics.EventLog [4.7.0](https://www.nuget.org/packages/System.Diagno Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- @@ -24,12 +24,11 @@ Remarks no remarks -Dependencies 2 +Dependencies 1 ----------- |Name|Version| |----------|:----| -|[Microsoft.Win32.Registry](../../../../packages/nuget.org/microsoft.win32.registry/5.0.0)|5.0.0| -|[System.Security.Principal.Windows](../../../../packages/nuget.org/system.security.principal.windows/5.0.0)|5.0.0| +|[System.Security.Principal.Windows](../../../../packages/nuget.org/system.security.principal.windows/4.7.0)|4.7.0| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/package.nuspec deleted file mode 100644 index 292fa0aa..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/package.nuspec +++ /dev/null @@ -1,33 +0,0 @@ - - - - System.Diagnostics.EventLog - 6.0.0 - Microsoft - MIT - https://licenses.nuget.org/MIT - Icon.png - https://dot.net/ - Provides the System.Diagnostics.EventLog class, which allows the applications to use the windows event log service. - -Commonly Used Types: -System.Diagnostics.EventLog - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/readme.md deleted file mode 100644 index 4b61a19a..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/readme.md +++ /dev/null @@ -1,30 +0,0 @@ -System.Diagnostics.EventLog [6.0.0](https://www.nuget.org/packages/System.Diagnostics.EventLog/6.0.0) --------------------- - -Used by: SqlDatabase internal - -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://licenses.nuget.org/MIT) -- repository license: [MIT](https://github.com/dotnet/runtime) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ - -Description ------------ -Provides the System.Diagnostics.EventLog class, which allows the applications to use the windows event log service. - -Commonly Used Types: -System.Diagnostics.EventLog - -Remarks ------------ -no remarks - - -Dependencies 0 ------------ - - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/index.json deleted file mode 100644 index 905d5fee..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/index.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "License": { - "Code": "MIT", - "Status": "AutomaticallyApproved" - }, - "UsedBy": [ - { - "Name": "SqlDatabase", - "InternalOnly": true, - "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" - ], - "Dependencies": [ - { - "Name": "Microsoft.Win32.Registry", - "Version": "5.0.0" - }, - { - "Name": "System.CodeDom", - "Version": "5.0.0" - } - ] - } - ], - "Licenses": [ - { - "Subject": "package", - "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null - }, - { - "Subject": "repository", - "Code": "MIT", - "HRef": "git://github.com/dotnet/runtime", - "Description": null - }, - { - "Subject": "project", - "Code": "MIT", - "HRef": "https://github.com/dotnet/runtime", - "Description": null - } - ] -} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/index.json similarity index 53% rename from Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/index.json rename to Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/index.json index cf67483a..fccb4cdd 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,13 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" + ], + "Dependencies": [ + { + "Name": "System.CodeDom", + "Version": "6.0.0" + } ] } ], @@ -20,20 +23,17 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "repository", "Code": "MIT", - "HRef": "git://github.com/dotnet/runtime", - "Description": null + "HRef": "https://github.com/dotnet/runtime" }, { "Subject": "project", - "Code": "MIT", - "HRef": "https://github.com/dotnet/runtime", - "Description": null + "Code": null, + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/project-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/project-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/package.nuspec similarity index 55% rename from Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/package.nuspec rename to Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/package.nuspec index 057dca93..6fd2bc59 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/package.nuspec +++ b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/package.nuspec @@ -1,42 +1,37 @@  - + System.Management - 5.0.0 - System.Management + 6.0.1 Microsoft - microsoft,dotnetframework - false MIT https://licenses.nuget.org/MIT Icon.png - https://github.com/dotnet/runtime - http://go.microsoft.com/fwlink/?LinkID=288859 + https://dot.net/ Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure. Commonly Used Types: System.Management.ManagementClass System.Management.ManagementObject -System.Management.SelectQuery - -When using NuGet 3.x this package requires at least version 3.4. +System.Management.SelectQuery https://go.microsoft.com/fwlink/?LinkID=799421 © Microsoft Corporation. All rights reserved. true - + - - - - - + + + + + + - + - + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/readme.md similarity index 59% rename from Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/readme.md rename to Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/readme.md index 668db812..f85bfd79 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/readme.md @@ -1,15 +1,15 @@ -System.Management [5.0.0](https://www.nuget.org/packages/System.Management/5.0.0) +System.Management [6.0.1](https://www.nuget.org/packages/System.Management/6.0.1) -------------------- Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- repository license: [MIT](git://github.com/dotnet/runtime) -- project license: [MIT](https://github.com/dotnet/runtime) +- repository license: [MIT](https://github.com/dotnet/runtime) +- project license: [Unknown](https://dot.net/) Description ----------- @@ -19,20 +19,17 @@ Commonly Used Types: System.Management.ManagementClass System.Management.ManagementObject System.Management.SelectQuery - -When using NuGet 3.x this package requires at least version 3.4. Remarks ----------- no remarks -Dependencies 2 +Dependencies 1 ----------- |Name|Version| |----------|:----| -|[Microsoft.Win32.Registry](../../../../packages/nuget.org/microsoft.win32.registry/5.0.0)|5.0.0| -|[System.CodeDom](../../../../packages/nuget.org/system.codedom/5.0.0)|5.0.0| +|[System.CodeDom](../../../../packages/nuget.org/system.codedom/6.0.0)|6.0.0| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/repository-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/repository-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/repository-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/repository-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.codedom/5.0.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.management/6.0.1/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/index.json similarity index 58% rename from Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/index.json rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/index.json index ebc0d666..424d9dad 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,20 +9,19 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ], "Dependencies": [ { - "Name": "System.Security.Cryptography.ProtectedData", - "Version": "4.5.0" + "Name": "System.Buffers", + "Version": "4.4.0" + }, + { + "Name": "System.Numerics.Vectors", + "Version": "4.4.0" }, { - "Name": "System.Security.Permissions", + "Name": "System.Runtime.CompilerServices.Unsafe", "Version": "4.5.0" } ] @@ -31,14 +31,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/package.nuspec new file mode 100644 index 00000000..e23e3439 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/package.nuspec @@ -0,0 +1,78 @@ + + + + System.Memory + 4.5.0 + System.Memory + Microsoft + microsoft,dotnetframework + false + https://github.com/dotnet/corefx/blob/master/LICENSE.TXT + https://dot.net/ + http://go.microsoft.com/fwlink/?LinkID=288859 + Provides types for efficient representation and pooling of managed, stack, and native memory segments and sequences of such segments, along with primitives to parse and format UTF-8 encoded text stored in those memory segments. + +Commonly Used Types: +System.Span +System.ReadOnlySpan +System.Memory +System.ReadOnlyMemory +System.Buffers.MemoryPool +System.Buffers.ReadOnlySequence +System.Buffers.Text.Utf8Parser +System.Buffers.Text.Utf8Formatter + +30ab651fcb4354552bd4891619a0bdd81e0ebdbf +When using NuGet 3.x this package requires at least version 3.4. + https://go.microsoft.com/fwlink/?LinkID=799421 + © Microsoft Corporation. All rights reserved. + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/readme.md new file mode 100644 index 00000000..108f2115 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/readme.md @@ -0,0 +1,44 @@ +System.Memory [4.5.0](https://www.nuget.org/packages/System.Memory/4.5.0) +-------------------- + +Used by: SqlDatabase + +Target frameworks: netstandard2.0 + +License: [MIT](../../../../licenses/mit) + +- package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) +- project license: [Unknown](https://dot.net/) + +Description +----------- +Provides types for efficient representation and pooling of managed, stack, and native memory segments and sequences of such segments, along with primitives to parse and format UTF-8 encoded text stored in those memory segments. + +Commonly Used Types: +System.Span +System.ReadOnlySpan +System.Memory +System.ReadOnlyMemory +System.Buffers.MemoryPool +System.Buffers.ReadOnlySequence +System.Buffers.Text.Utf8Parser +System.Buffers.Text.Utf8Formatter + +30ab651fcb4354552bd4891619a0bdd81e0ebdbf +When using NuGet 3.x this package requires at least version 3.4. + +Remarks +----------- +no remarks + + +Dependencies 3 +----------- + +|Name|Version| +|----------|:----| +|[System.Buffers](../../../../packages/nuget.org/system.buffers/4.4.0)|4.4.0| +|[System.Numerics.Vectors](../../../../packages/nuget.org/system.numerics.vectors/4.4.0)|4.4.0| +|[System.Runtime.CompilerServices.Unsafe](../../../../packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0)|4.5.0| + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.configuration.configurationmanager/4.5.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/index.json b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/index.json index 45273c52..ecf6310f 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,6 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ], "Dependencies": [ @@ -20,6 +16,10 @@ "Name": "System.Buffers", "Version": "4.4.0" }, + { + "Name": "System.Numerics.Vectors", + "Version": "4.4.0" + }, { "Name": "System.Runtime.CompilerServices.Unsafe", "Version": "4.5.2" @@ -31,14 +31,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/readme.md b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/readme.md index 5f16d3a0..7e47f857 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.3/readme.md @@ -3,12 +3,12 @@ System.Memory [4.5.3](https://www.nuget.org/packages/System.Memory/4.5.3) Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- @@ -32,12 +32,13 @@ Remarks no remarks -Dependencies 2 +Dependencies 3 ----------- |Name|Version| |----------|:----| |[System.Buffers](../../../../packages/nuget.org/system.buffers/4.4.0)|4.4.0| +|[System.Numerics.Vectors](../../../../packages/nuget.org/system.numerics.vectors/4.4.0)|4.4.0| |[System.Runtime.CompilerServices.Unsafe](../../../../packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2)|4.5.2| *This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/index.json b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/index.json index 490b41df..a1e7bf15 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", + "net472", "netstandard2.0" ], "Dependencies": [ @@ -35,14 +32,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/readme.md b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/readme.md index 430ba24c..ba47fe32 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.4/readme.md @@ -3,12 +3,12 @@ System.Memory [4.5.4](https://www.nuget.org/packages/System.Memory/4.5.4) Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/index.json similarity index 54% rename from Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/index.json rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/index.json index faff1fec..14b4bc4b 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -6,19 +7,22 @@ "UsedBy": [ { "Name": "SqlDatabase", - "InternalOnly": false, + "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ], "Dependencies": [ { - "Name": "System.Security.AccessControl", - "Version": "4.7.0" + "Name": "System.Buffers", + "Version": "4.5.1" + }, + { + "Name": "System.Numerics.Vectors", + "Version": "4.4.0" + }, + { + "Name": "System.Runtime.CompilerServices.Unsafe", + "Version": "4.5.3" } ] } @@ -27,14 +31,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/4.7.0/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/package.nuspec new file mode 100644 index 00000000..2c1dc836 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/package.nuspec @@ -0,0 +1,105 @@ + + + + System.Memory + 4.5.5 + System.Memory + Microsoft + microsoft,dotnetframework + false + https://github.com/dotnet/corefx/blob/master/LICENSE.TXT + https://dot.net/ + http://go.microsoft.com/fwlink/?LinkID=288859 + Provides types for efficient representation and pooling of managed, stack, and native memory segments and sequences of such segments, along with primitives to parse and format UTF-8 encoded text stored in those memory segments. + +Commonly Used Types: +System.Span +System.ReadOnlySpan +System.Memory +System.ReadOnlyMemory +System.Buffers.MemoryPool +System.Buffers.ReadOnlySequence +System.Buffers.Text.Utf8Parser +System.Buffers.Text.Utf8Formatter + +32b491939fbd125f304031c35038b1e14b4e3958 +When using NuGet 3.x this package requires at least version 3.4. + https://go.microsoft.com/fwlink/?LinkID=799421 + © Microsoft Corporation. All rights reserved. + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/readme.md b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/readme.md new file mode 100644 index 00000000..148edfdd --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/readme.md @@ -0,0 +1,44 @@ +System.Memory [4.5.5](https://www.nuget.org/packages/System.Memory/4.5.5) +-------------------- + +Used by: SqlDatabase internal + +Target frameworks: netstandard2.0 + +License: [MIT](../../../../licenses/mit) + +- package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) +- project license: [Unknown](https://dot.net/) + +Description +----------- +Provides types for efficient representation and pooling of managed, stack, and native memory segments and sequences of such segments, along with primitives to parse and format UTF-8 encoded text stored in those memory segments. + +Commonly Used Types: +System.Span +System.ReadOnlySpan +System.Memory +System.ReadOnlyMemory +System.Buffers.MemoryPool +System.Buffers.ReadOnlySequence +System.Buffers.Text.Utf8Parser +System.Buffers.Text.Utf8Formatter + +32b491939fbd125f304031c35038b1e14b4e3958 +When using NuGet 3.x this package requires at least version 3.4. + +Remarks +----------- +no remarks + + +Dependencies 3 +----------- + +|Name|Version| +|----------|:----| +|[System.Buffers](../../../../packages/nuget.org/system.buffers/4.5.1)|4.5.1| +|[System.Numerics.Vectors](../../../../packages/nuget.org/system.numerics.vectors/4.4.0)|4.4.0| +|[System.Runtime.CompilerServices.Unsafe](../../../../packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3)|4.5.3| + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.memory/4.5.5/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/index.json index 79494e46..32f97a40 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", + "net472", "netstandard2.0" ] } @@ -21,14 +18,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/readme.md index 90eaae20..77fe24e5 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.numerics.vectors/4.4.0/readme.md @@ -3,12 +3,12 @@ System.Numerics.Vectors [4.4.0](https://www.nuget.org/packages/System.Numerics.V Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/index.json new file mode 100644 index 00000000..6786e835 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/index.json @@ -0,0 +1,28 @@ +{ + "Source": "https://api.nuget.org/v3/index.json", + "License": { + "Code": "MIT", + "Status": "AutomaticallyApproved" + }, + "UsedBy": [ + { + "Name": "SqlDatabase", + "InternalOnly": true, + "TargetFrameworks": [ + "netstandard2.0" + ] + } + ], + "Licenses": [ + { + "Subject": "package", + "Code": "MIT", + "HRef": "https://licenses.nuget.org/MIT" + }, + { + "Subject": "project", + "Code": null, + "HRef": "https://github.com/dotnet/corefx" + } + ] +} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/package.nuspec new file mode 100644 index 00000000..8761f62c --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/package.nuspec @@ -0,0 +1,59 @@ + + + + System.Reflection.Emit.ILGeneration + 4.7.0 + System.Reflection.Emit.ILGeneration + Microsoft + microsoft,dotnetframework + false + MIT + https://licenses.nuget.org/MIT + https://github.com/dotnet/corefx + http://go.microsoft.com/fwlink/?LinkID=288859 + Provides classes that allow a compiler or tool to emit Microsoft intermediate language (MSIL). The primary clients of these classes are script engines and compilers. + +Commonly Used Types: +System.Reflection.Emit.ILGenerator +System.Reflection.Emit.Label +System.Reflection.Emit.CustomAttributeBuilder +System.Reflection.Emit.LocalBuilder +System.Reflection.Emit.ParameterBuilder +System.Reflection.Emit.SignatureHelper + +When using NuGet 3.x this package requires at least version 3.4. + https://go.microsoft.com/fwlink/?LinkID=799421 + © Microsoft Corporation. All rights reserved. + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/readme.md new file mode 100644 index 00000000..8d929093 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/readme.md @@ -0,0 +1,36 @@ +System.Reflection.Emit.ILGeneration [4.7.0](https://www.nuget.org/packages/System.Reflection.Emit.ILGeneration/4.7.0) +-------------------- + +Used by: SqlDatabase internal + +Target frameworks: netstandard2.0 + +License: [MIT](../../../../licenses/mit) + +- package license: [MIT](https://licenses.nuget.org/MIT) +- project license: [Unknown](https://github.com/dotnet/corefx) + +Description +----------- +Provides classes that allow a compiler or tool to emit Microsoft intermediate language (MSIL). The primary clients of these classes are script engines and compilers. + +Commonly Used Types: +System.Reflection.Emit.ILGenerator +System.Reflection.Emit.Label +System.Reflection.Emit.CustomAttributeBuilder +System.Reflection.Emit.LocalBuilder +System.Reflection.Emit.ParameterBuilder +System.Reflection.Emit.SignatureHelper + +When using NuGet 3.x this package requires at least version 3.4. + +Remarks +----------- +no remarks + + +Dependencies 0 +----------- + + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/index.json new file mode 100644 index 00000000..00a018c2 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/index.json @@ -0,0 +1,34 @@ +{ + "Source": "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\", + "License": { + "Code": "MIT", + "Status": "AutomaticallyApproved" + }, + "UsedBy": [ + { + "Name": "SqlDatabase", + "InternalOnly": true, + "TargetFrameworks": [ + "netstandard2.0" + ], + "Dependencies": [ + { + "Name": "System.Reflection.Emit.ILGeneration", + "Version": "4.7.0" + } + ] + } + ], + "Licenses": [ + { + "Subject": "package", + "Code": "MIT", + "HRef": "https://licenses.nuget.org/MIT" + }, + { + "Subject": "project", + "Code": null, + "HRef": "https://github.com/dotnet/corefx" + } + ] +} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/repository-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.diagnostics.eventlog/6.0.0/repository-LICENSE.TXT rename to Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/package.nuspec new file mode 100644 index 00000000..ff5cb252 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/package.nuspec @@ -0,0 +1,77 @@ + + + + System.Reflection.Emit + 4.7.0 + System.Reflection.Emit + Microsoft + microsoft,dotnetframework + false + MIT + https://licenses.nuget.org/MIT + https://github.com/dotnet/corefx + http://go.microsoft.com/fwlink/?LinkID=288859 + Provides classes that allow a compiler or tool to emit metadata and optionally generate a PE file on disk. The primary clients of these classes are script engines and compilers. + +Commonly Used Types: +System.Reflection.Emit.AssemblyBuilder +System.Reflection.Emit.FieldBuilder +System.Reflection.Emit.TypeBuilder +System.Reflection.Emit.MethodBuilder +System.Reflection.Emit.ConstructorBuilder +System.Reflection.Emit.GenericTypeParameterBuilder +System.Reflection.Emit.ModuleBuilder +System.Reflection.Emit.PropertyBuilder +System.Reflection.Emit.AssemblyBuilderAccess +System.Reflection.Emit.EventBuilder + +When using NuGet 3.x this package requires at least version 3.4. + https://go.microsoft.com/fwlink/?LinkID=799421 + © Microsoft Corporation. All rights reserved. + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/readme.md new file mode 100644 index 00000000..5d6571b2 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/readme.md @@ -0,0 +1,43 @@ +System.Reflection.Emit [4.7.0](https://www.nuget.org/packages/System.Reflection.Emit/4.7.0) +-------------------- + +Used by: SqlDatabase internal + +Target frameworks: netstandard2.0 + +License: [MIT](../../../../licenses/mit) + +- package license: [MIT](https://licenses.nuget.org/MIT) +- project license: [Unknown](https://github.com/dotnet/corefx) + +Description +----------- +Provides classes that allow a compiler or tool to emit metadata and optionally generate a PE file on disk. The primary clients of these classes are script engines and compilers. + +Commonly Used Types: +System.Reflection.Emit.AssemblyBuilder +System.Reflection.Emit.FieldBuilder +System.Reflection.Emit.TypeBuilder +System.Reflection.Emit.MethodBuilder +System.Reflection.Emit.ConstructorBuilder +System.Reflection.Emit.GenericTypeParameterBuilder +System.Reflection.Emit.ModuleBuilder +System.Reflection.Emit.PropertyBuilder +System.Reflection.Emit.AssemblyBuilderAccess +System.Reflection.Emit.EventBuilder + +When using NuGet 3.x this package requires at least version 3.4. + +Remarks +----------- +no remarks + + +Dependencies 1 +----------- + +|Name|Version| +|----------|:----| +|[System.Reflection.Emit.ILGeneration](../../../../packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0)|4.7.0| + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.reflection.emit/4.7.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/index.json index 38ac01dc..1bbad59c 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net472" + "net8.0" ] } ], @@ -20,8 +20,7 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", diff --git a/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/readme.md index 305a9aab..e2a51fb2 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.reflection.metadata/1.6.0/readme.md @@ -3,7 +3,7 @@ System.Reflection.Metadata [1.6.0](https://www.nuget.org/packages/System.Reflect Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: net472, net6.0, net7.0, net8.0 License: [MIT](../../../../licenses/mit) diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/index.json similarity index 64% rename from Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/index.json rename to Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/index.json index 79494e46..082ffec6 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,6 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ] } @@ -21,14 +17,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/package-LICENSE.TXT similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.management/5.0.0/package-LICENSE.txt rename to Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/package-LICENSE.TXT diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/package.nuspec new file mode 100644 index 00000000..8235d41b --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/package.nuspec @@ -0,0 +1,37 @@ + + + + System.Runtime.CompilerServices.Unsafe + 4.5.0 + System.Runtime.CompilerServices.Unsafe + Microsoft + microsoft,dotnetframework + false + https://github.com/dotnet/corefx/blob/master/LICENSE.TXT + https://dot.net/ + http://go.microsoft.com/fwlink/?LinkID=288859 + Provides the System.Runtime.CompilerServices.Unsafe class, which provides generic, low-level functionality for manipulating pointers. + +Commonly Used Types: +System.Runtime.CompilerServices.Unsafe + +30ab651fcb4354552bd4891619a0bdd81e0ebdbf +When using NuGet 3.x this package requires at least version 3.4. + https://go.microsoft.com/fwlink/?LinkID=799421 + © Microsoft Corporation. All rights reserved. + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/readme.md new file mode 100644 index 00000000..f6c5a27f --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/readme.md @@ -0,0 +1,32 @@ +System.Runtime.CompilerServices.Unsafe [4.5.0](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/4.5.0) +-------------------- + +Used by: SqlDatabase + +Target frameworks: netstandard2.0 + +License: [MIT](../../../../licenses/mit) + +- package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) +- project license: [Unknown](https://dot.net/) + +Description +----------- +Provides the System.Runtime.CompilerServices.Unsafe class, which provides generic, low-level functionality for manipulating pointers. + +Commonly Used Types: +System.Runtime.CompilerServices.Unsafe + +30ab651fcb4354552bd4891619a0bdd81e0ebdbf +When using NuGet 3.x this package requires at least version 3.4. + +Remarks +----------- +no remarks + + +Dependencies 0 +----------- + + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/index.json b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/index.json index 79494e46..082ffec6 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,6 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ] } @@ -21,14 +17,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/readme.md b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/readme.md index 90d09d50..c59b68cf 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2/readme.md @@ -3,12 +3,12 @@ System.Runtime.CompilerServices.Unsafe [4.5.2](https://www.nuget.org/packages/Sy Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/index.json b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/index.json index 38ac01dc..581a7123 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" ] } ], @@ -20,14 +17,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/readme.md b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/readme.md index f088c659..67fdfc27 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3/readme.md @@ -3,12 +3,12 @@ System.Runtime.CompilerServices.Unsafe [4.5.3](https://www.nuget.org/packages/Sy Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/index.json index 385b2cc1..5b097663 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", + "net472", "netstandard2.0" ] } @@ -21,14 +18,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/readme.md index 845ad510..ce59f306 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0/readme.md @@ -3,12 +3,12 @@ System.Runtime.CompilerServices.Unsafe [4.7.0](https://www.nuget.org/packages/Sy Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/package.nuspec deleted file mode 100644 index ea8fad1d..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/package.nuspec +++ /dev/null @@ -1,52 +0,0 @@ - - - - System.Runtime.InteropServices.RuntimeInformation - 4.3.0 - System.Runtime.InteropServices.RuntimeInformation - Microsoft - microsoft,dotnetframework - true - http://go.microsoft.com/fwlink/?LinkId=329770 - https://dot.net/ - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides APIs to query about runtime and OS information. - -Commonly Used Types: -System.Runtime.InteropServices.RuntimeInformation -System.Runtime.InteropServices.OSPlatform - -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/readme.md deleted file mode 100644 index 1e34e11e..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/readme.md +++ /dev/null @@ -1,32 +0,0 @@ -System.Runtime.InteropServices.RuntimeInformation [4.3.0](https://www.nuget.org/packages/System.Runtime.InteropServices.RuntimeInformation/4.3.0) --------------------- - -Used by: SqlDatabase internal - -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 - -License: [ms-net-library](../../../../licenses/ms-net-library) - -- package license: [ms-net-library](http://go.microsoft.com/fwlink/?LinkId=329770) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ - -Description ------------ -Provides APIs to query about runtime and OS information. - -Commonly Used Types: -System.Runtime.InteropServices.RuntimeInformation -System.Runtime.InteropServices.OSPlatform - -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 0 ------------ - - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/index.json index a5362ddb..c9617aac 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "ms-net-library", "Status": "AutomaticallyApproved" @@ -8,11 +9,6 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ] } @@ -21,14 +17,12 @@ { "Subject": "package", "Code": "ms-net-library", - "HRef": "http://go.microsoft.com/fwlink/?LinkId=329770", - "Description": null + "HRef": "http://go.microsoft.com/fwlink/?LinkId=329770" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/package-dotnet_library_license.txt b/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/package-dotnet_library_license.txt new file mode 100644 index 00000000..92b6c443 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/package-dotnet_library_license.txt @@ -0,0 +1,128 @@ + +MICROSOFT SOFTWARE LICENSE TERMS + + +MICROSOFT .NET LIBRARY + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft + +· updates, + +· supplements, + +· Internet-based services, and + +· support services + +for this software, unless other terms accompany those items. If so, those terms apply. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW. + +1. INSTALLATION AND USE RIGHTS. + +a. Installation and Use. You may install and use any number of copies of the software to design, develop and test your programs. + +b. Third Party Programs. The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only. + +2. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS. + +a. DISTRIBUTABLE CODE. The software is comprised of Distributable Code. “Distributable Code” is code that you are permitted to distribute in programs you develop if you comply with the terms below. + +i. Right to Use and Distribute. + +· You may copy and distribute the object code form of the software. + +· Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs. + +ii. Distribution Requirements. For any Distributable Code you distribute, you must + +· add significant primary functionality to it in your programs; + +· require distributors and external end users to agree to terms that protect it at least as much as this agreement; + +· display your valid copyright notice on your programs; and + +· indemnify, defend, and hold harmless Microsoft from any claims, including attorneys’ fees, related to the distribution or use of your programs. + +iii. Distribution Restrictions. You may not + +· alter any copyright, trademark or patent notice in the Distributable Code; + +· use Microsoft’s trademarks in your programs’ names or in a way that suggests your programs come from or are endorsed by Microsoft; + +· include Distributable Code in malicious, deceptive or unlawful programs; or + +· modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that + +· the code be disclosed or distributed in source code form; or + +· others have the right to modify it. + +3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not + +· work around any technical limitations in the software; + +· reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation; + +· publish the software for others to copy; + +· rent, lease or lend the software; + +· transfer the software or this agreement to any third party; or + +· use the software for commercial software hosting services. + +4. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall the software. + +5. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes. + +6. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting. + +7. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it. + +8. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services. + +9. APPLICABLE LAW. + +a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort. + +b. Outside the United States. If you acquired the software in any other country, the laws of that country apply. + +10. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so. + +11. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + +FOR AUSTRALIA – YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS. + +12. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES. + +This limitation applies to + +· anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and + +· claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law. + +It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages. + +Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French. + +Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français. + +EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues. + +LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices. + +Cette limitation concerne : + +· tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et + +· les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d’une autre faute dans la limite autorisée par la loi en vigueur. + +Elle s’applique également, même si Microsoft connaissait ou devrait connaître l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l’exclusion ci-dessus ne s’appliquera pas à votre égard. + +EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas. + + diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/readme.md index 7a0c1cde..3d3c47d9 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.runtime.loader/4.3.0/readme.md @@ -3,12 +3,12 @@ System.Runtime.Loader [4.3.0](https://www.nuget.org/packages/System.Runtime.Load Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: netstandard2.0 License: [ms-net-library](../../../../licenses/ms-net-library) - package license: [ms-net-library](http://go.microsoft.com/fwlink/?LinkId=329770) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/index.json index f50d9fc5..2fecc9f9 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", + "net8.0", "netstandard2.0" ], "Dependencies": [ @@ -27,14 +27,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/readme.md index b00cf455..ba201c8e 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/4.7.0/readme.md @@ -3,12 +3,12 @@ System.Security.AccessControl [4.7.0](https://www.nuget.org/packages/System.Secu Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/index.json deleted file mode 100644 index dd3e3159..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/index.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "License": { - "Code": "MIT", - "Status": "AutomaticallyApproved" - }, - "UsedBy": [ - { - "Name": "SqlDatabase", - "InternalOnly": true, - "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" - ], - "Dependencies": [ - { - "Name": "System.Security.Principal.Windows", - "Version": "5.0.0" - } - ] - } - ], - "Licenses": [ - { - "Subject": "package", - "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null - }, - { - "Subject": "repository", - "Code": "MIT", - "HRef": "git://github.com/dotnet/runtime", - "Description": null - }, - { - "Subject": "project", - "Code": "MIT", - "HRef": "https://github.com/dotnet/runtime", - "Description": null - } - ] -} \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/package.nuspec deleted file mode 100644 index 532ae482..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/package.nuspec +++ /dev/null @@ -1,55 +0,0 @@ - - - - System.Security.AccessControl - 5.0.0 - System.Security.AccessControl - Microsoft - microsoft,dotnetframework - false - MIT - https://licenses.nuget.org/MIT - Icon.png - https://github.com/dotnet/runtime - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides base classes that enable managing access and audit control lists on securable objects. - -Commonly Used Types: -System.Security.AccessControl.AccessRule -System.Security.AccessControl.AuditRule -System.Security.AccessControl.ObjectAccessRule -System.Security.AccessControl.ObjectAuditRule -System.Security.AccessControl.ObjectSecurity - -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/readme.md deleted file mode 100644 index aa1a2b52..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -System.Security.AccessControl [5.0.0](https://www.nuget.org/packages/System.Security.AccessControl/5.0.0) --------------------- - -Used by: SqlDatabase internal - -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://licenses.nuget.org/MIT) -- repository license: [MIT](git://github.com/dotnet/runtime) -- project license: [MIT](https://github.com/dotnet/runtime) - -Description ------------ -Provides base classes that enable managing access and audit control lists on securable objects. - -Commonly Used Types: -System.Security.AccessControl.AccessRule -System.Security.AccessControl.AuditRule -System.Security.AccessControl.ObjectAccessRule -System.Security.AccessControl.ObjectAuditRule -System.Security.AccessControl.ObjectSecurity - -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 1 ------------ - -|Name|Version| -|----------|:----| -|[System.Security.Principal.Windows](../../../../packages/nuget.org/system.security.principal.windows/5.0.0)|5.0.0| - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/repository-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/repository-LICENSE.TXT deleted file mode 100644 index 984713a4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.accesscontrol/5.0.0/repository-LICENSE.TXT +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/package-LICENSE.txt deleted file mode 100644 index 984713a4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/package-LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/package.nuspec deleted file mode 100644 index a4f6089a..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/package.nuspec +++ /dev/null @@ -1,49 +0,0 @@ - - - - System.Security.Cryptography.ProtectedData - 4.5.0 - System.Security.Cryptography.ProtectedData - Microsoft - microsoft,dotnetframework - false - https://github.com/dotnet/corefx/blob/master/LICENSE.TXT - https://dot.net/ - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides access to Windows Data Protection Api. - -Commonly Used Types: -System.Security.Cryptography.DataProtectionScope -System.Security.Cryptography.ProtectedData - -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/readme.md deleted file mode 100644 index 1f0968e5..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -System.Security.Cryptography.ProtectedData [4.5.0](https://www.nuget.org/packages/System.Security.Cryptography.ProtectedData/4.5.0) --------------------- - -Used by: SqlDatabase - -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ - -Description ------------ -Provides access to Windows Data Protection Api. - -Commonly Used Types: -System.Security.Cryptography.DataProtectionScope -System.Security.Cryptography.ProtectedData - -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 0 ------------ - - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/package-LICENSE.txt deleted file mode 100644 index 984713a4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/package-LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/package.nuspec deleted file mode 100644 index b839fab2..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/package.nuspec +++ /dev/null @@ -1,39 +0,0 @@ - - - - System.Security.Permissions - 4.5.0 - System.Security.Permissions - Microsoft - microsoft,dotnetframework - false - https://github.com/dotnet/corefx/blob/master/LICENSE.TXT - https://dot.net/ - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides types supporting Code Access Security (CAS). -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/readme.md deleted file mode 100644 index 6d0b5d57..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/readme.md +++ /dev/null @@ -1,31 +0,0 @@ -System.Security.Permissions [4.5.0](https://www.nuget.org/packages/System.Security.Permissions/4.5.0) --------------------- - -Used by: SqlDatabase - -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ - -Description ------------ -Provides types supporting Code Access Security (CAS). -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 1 ------------ - -|Name|Version| -|----------|:----| -|[System.Security.AccessControl](../../../../packages/nuget.org/system.security.accesscontrol/4.7.0)|4.7.0| - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/remarks.md deleted file mode 100644 index e69de29b..00000000 diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.security.permissions/4.5.0/third-party-notices.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/index.json index 385b2cc1..cefc7084 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,10 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", + "net472", "net6.0", "net7.0", - "net452", + "net8.0", "netstandard2.0" ] } @@ -21,14 +21,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/readme.md index 4c4644fa..c9e3bf5d 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/4.7.0/readme.md @@ -3,12 +3,12 @@ System.Security.Principal.Windows [4.7.0](https://www.nuget.org/packages/System. Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, net6.0, net7.0, net8.0, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/package-LICENSE.txt deleted file mode 100644 index 984713a4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/package-LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/package.nuspec deleted file mode 100644 index a1ff48c6..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/package.nuspec +++ /dev/null @@ -1,68 +0,0 @@ - - - - System.Security.Principal.Windows - 5.0.0 - System.Security.Principal.Windows - Microsoft - microsoft,dotnetframework - false - MIT - https://licenses.nuget.org/MIT - Icon.png - https://github.com/dotnet/runtime - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides classes for retrieving the current Windows user and for interacting with Windows users and groups. - -Commonly Used Types: -System.Security.Principal.WindowsIdentity -System.Security.Principal.SecurityIdentifier -System.Security.Principal.NTAccount -System.Security.Principal.WindowsPrincipal -System.Security.Principal.IdentityReference -System.Security.Principal.IdentityNotMappedException -System.Security.Principal.WindowsBuiltInRole -System.Security.Principal.WellKnownSidType - -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/project-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/project-LICENSE.TXT deleted file mode 100644 index 984713a4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/project-LICENSE.TXT +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/readme.md deleted file mode 100644 index 822481c5..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -System.Security.Principal.Windows [5.0.0](https://www.nuget.org/packages/System.Security.Principal.Windows/5.0.0) --------------------- - -Used by: SqlDatabase internal - -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://licenses.nuget.org/MIT) -- repository license: [MIT](git://github.com/dotnet/runtime) -- project license: [MIT](https://github.com/dotnet/runtime) - -Description ------------ -Provides classes for retrieving the current Windows user and for interacting with Windows users and groups. - -Commonly Used Types: -System.Security.Principal.WindowsIdentity -System.Security.Principal.SecurityIdentifier -System.Security.Principal.NTAccount -System.Security.Principal.WindowsPrincipal -System.Security.Principal.IdentityReference -System.Security.Principal.IdentityNotMappedException -System.Security.Principal.WindowsBuiltInRole -System.Security.Principal.WellKnownSidType - -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 0 ------------ - - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/remarks.md deleted file mode 100644 index e69de29b..00000000 diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/repository-LICENSE.TXT b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/repository-LICENSE.TXT deleted file mode 100644 index 984713a4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/repository-LICENSE.TXT +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.security.principal.windows/5.0.0/third-party-notices.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/index.json index 4b2f1050..6cc05047 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", + "net472", "netstandard2.0" ], "Dependencies": [ @@ -27,14 +24,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://licenses.nuget.org/MIT", - "Description": null + "HRef": "https://licenses.nuget.org/MIT" }, { "Subject": "project", "Code": null, - "HRef": "https://github.com/dotnet/corefx", - "Description": "License should be verified on https://github.com/dotnet/corefx" + "HRef": "https://github.com/dotnet/corefx" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/readme.md index 018b3667..ae05e7a9 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.text.encoding.codepages/4.7.0/readme.md @@ -3,12 +3,12 @@ System.Text.Encoding.CodePages [4.7.0](https://www.nuget.org/packages/System.Tex Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: net472, netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://licenses.nuget.org/MIT) -- project license: [Unknown](https://github.com/dotnet/corefx) , License should be verified on https://github.com/dotnet/corefx +- project license: [Unknown](https://github.com/dotnet/corefx) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/index.json b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/index.json similarity index 51% rename from Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/index.json rename to Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/index.json index 167f0424..c9617aac 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "ms-net-library", "Status": "AutomaticallyApproved" @@ -6,13 +7,9 @@ "UsedBy": [ { "Name": "SqlDatabase", - "InternalOnly": true, + "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" ] } ], @@ -20,14 +17,12 @@ { "Subject": "package", "Code": "ms-net-library", - "HRef": "http://go.microsoft.com/fwlink/?LinkId=329770", - "Description": null + "HRef": "http://go.microsoft.com/fwlink/?LinkId=329770" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/package-dotnet_library_license.txt b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/package-dotnet_library_license.txt new file mode 100644 index 00000000..92b6c443 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/package-dotnet_library_license.txt @@ -0,0 +1,128 @@ + +MICROSOFT SOFTWARE LICENSE TERMS + + +MICROSOFT .NET LIBRARY + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft + +· updates, + +· supplements, + +· Internet-based services, and + +· support services + +for this software, unless other terms accompany those items. If so, those terms apply. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW. + +1. INSTALLATION AND USE RIGHTS. + +a. Installation and Use. You may install and use any number of copies of the software to design, develop and test your programs. + +b. Third Party Programs. The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only. + +2. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS. + +a. DISTRIBUTABLE CODE. The software is comprised of Distributable Code. “Distributable Code” is code that you are permitted to distribute in programs you develop if you comply with the terms below. + +i. Right to Use and Distribute. + +· You may copy and distribute the object code form of the software. + +· Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs. + +ii. Distribution Requirements. For any Distributable Code you distribute, you must + +· add significant primary functionality to it in your programs; + +· require distributors and external end users to agree to terms that protect it at least as much as this agreement; + +· display your valid copyright notice on your programs; and + +· indemnify, defend, and hold harmless Microsoft from any claims, including attorneys’ fees, related to the distribution or use of your programs. + +iii. Distribution Restrictions. You may not + +· alter any copyright, trademark or patent notice in the Distributable Code; + +· use Microsoft’s trademarks in your programs’ names or in a way that suggests your programs come from or are endorsed by Microsoft; + +· include Distributable Code in malicious, deceptive or unlawful programs; or + +· modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that + +· the code be disclosed or distributed in source code form; or + +· others have the right to modify it. + +3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not + +· work around any technical limitations in the software; + +· reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation; + +· publish the software for others to copy; + +· rent, lease or lend the software; + +· transfer the software or this agreement to any third party; or + +· use the software for commercial software hosting services. + +4. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall the software. + +5. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes. + +6. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting. + +7. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it. + +8. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services. + +9. APPLICABLE LAW. + +a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort. + +b. Outside the United States. If you acquired the software in any other country, the laws of that country apply. + +10. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so. + +11. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + +FOR AUSTRALIA – YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS. + +12. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES. + +This limitation applies to + +· anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and + +· claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law. + +It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages. + +Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French. + +Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français. + +EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues. + +LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices. + +Cette limitation concerne : + +· tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et + +· les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d’une autre faute dans la limite autorisée par la loi en vigueur. + +Elle s’applique également, même si Microsoft connaissait ou devrait connaître l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l’exclusion ci-dessus ne s’appliquera pas à votre égard. + +EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas. + + diff --git a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/package.nuspec new file mode 100644 index 00000000..6f6dc811 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/package.nuspec @@ -0,0 +1,38 @@ + + + + System.Threading.Tasks.Extensions + 4.3.0 + System.Threading.Tasks.Extensions + Microsoft + microsoft,dotnetframework + true + http://go.microsoft.com/fwlink/?LinkId=329770 + https://dot.net/ + http://go.microsoft.com/fwlink/?LinkID=288859 + Provides additional types that simplify the work of writing concurrent and asynchronous code. + +Commonly Used Types: +System.Threading.Tasks.ValueTask<TResult> + https://go.microsoft.com/fwlink/?LinkID=799421 + © Microsoft Corporation. All rights reserved. + true + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/readme.md new file mode 100644 index 00000000..0ce97f35 --- /dev/null +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/readme.md @@ -0,0 +1,29 @@ +System.Threading.Tasks.Extensions [4.3.0](https://www.nuget.org/packages/System.Threading.Tasks.Extensions/4.3.0) +-------------------- + +Used by: SqlDatabase + +Target frameworks: netstandard2.0 + +License: [ms-net-library](../../../../licenses/ms-net-library) + +- package license: [ms-net-library](http://go.microsoft.com/fwlink/?LinkId=329770) +- project license: [Unknown](https://dot.net/) + +Description +----------- +Provides additional types that simplify the work of writing concurrent and asynchronous code. + +Commonly Used Types: +System.Threading.Tasks.ValueTask + +Remarks +----------- +no remarks + + +Dependencies 0 +----------- + + +*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/remarks.md similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/remarks.md rename to Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/remarks.md diff --git a/Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/third-party-notices.txt similarity index 100% rename from Build/third-party-libraries/packages/nuget.org/system.security.cryptography.protecteddata/4.5.0/third-party-notices.txt rename to Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.3.0/third-party-notices.txt diff --git a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/index.json b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/index.json index ff360d3b..3c94c934 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,6 @@ "Name": "SqlDatabase", "InternalOnly": false, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net452", "netstandard2.0" ], "Dependencies": [ @@ -27,14 +23,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/readme.md b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/readme.md index aa5792bd..50cb3d5e 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.2/readme.md @@ -3,12 +3,12 @@ System.Threading.Tasks.Extensions [4.5.2](https://www.nuget.org/packages/System. Used by: SqlDatabase -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/index.json b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/index.json index 07520a84..9c30edc5 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/index.json +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/index.json @@ -1,4 +1,5 @@ { + "Source": "https://api.nuget.org/v3/index.json", "License": { "Code": "MIT", "Status": "AutomaticallyApproved" @@ -8,11 +9,7 @@ "Name": "SqlDatabase", "InternalOnly": true, "TargetFrameworks": [ - "netcoreapp3.1", - "net5.0", - "net6.0", - "net7.0", - "net472" + "netstandard2.0" ], "Dependencies": [ { @@ -26,14 +23,12 @@ { "Subject": "package", "Code": "MIT", - "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT", - "Description": null + "HRef": "https://github.com/dotnet/corefx/blob/master/LICENSE.TXT" }, { "Subject": "project", "Code": null, - "HRef": "https://dot.net/", - "Description": "License should be verified on https://dot.net/" + "HRef": "https://dot.net/" } ] } \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/readme.md b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/readme.md index 05629083..2c92941d 100644 --- a/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/readme.md +++ b/Build/third-party-libraries/packages/nuget.org/system.threading.tasks.extensions/4.5.4/readme.md @@ -3,12 +3,12 @@ System.Threading.Tasks.Extensions [4.5.4](https://www.nuget.org/packages/System. Used by: SqlDatabase internal -Target frameworks: net472, net5.0, net6.0, net7.0, netcoreapp3.1 +Target frameworks: netstandard2.0 License: [MIT](../../../../licenses/mit) - package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ +- project license: [Unknown](https://dot.net/) Description ----------- diff --git a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/package-LICENSE.txt b/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/package-LICENSE.txt deleted file mode 100644 index 984713a4..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/package-LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/package.nuspec b/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/package.nuspec deleted file mode 100644 index b0629162..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/package.nuspec +++ /dev/null @@ -1,58 +0,0 @@ - - - - System.ValueTuple - 4.5.0 - System.ValueTuple - Microsoft - microsoft,dotnetframework - false - https://github.com/dotnet/corefx/blob/master/LICENSE.TXT - https://dot.net/ - http://go.microsoft.com/fwlink/?LinkID=288859 - Provides the System.ValueTuple structs, which implement the underlying types for tuples in C# and Visual Basic. - -Commonly Used Types: -System.ValueTuple -System.ValueTuple<T1> -System.ValueTuple<T1, T2> -System.ValueTuple<T1, T2, T3> -System.ValueTuple<T1, T2, T3, T4> -System.ValueTuple<T1, T2, T3, T4, T5> -System.ValueTuple<T1, T2, T3, T4, T5, T6> -System.ValueTuple<T1, T2, T3, T4, T5, T6, T7> -System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> - -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - https://go.microsoft.com/fwlink/?LinkID=799421 - © Microsoft Corporation. All rights reserved. - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/readme.md b/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/readme.md deleted file mode 100644 index b989e0ee..00000000 --- a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/readme.md +++ /dev/null @@ -1,40 +0,0 @@ -System.ValueTuple [4.5.0](https://www.nuget.org/packages/System.ValueTuple/4.5.0) --------------------- - -Used by: SqlDatabase - -Target frameworks: net452, net5.0, net6.0, net7.0, netcoreapp3.1, netstandard2.0 - -License: [MIT](../../../../licenses/mit) - -- package license: [MIT](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) -- project license: [Unknown](https://dot.net/) , License should be verified on https://dot.net/ - -Description ------------ -Provides the System.ValueTuple structs, which implement the underlying types for tuples in C# and Visual Basic. - -Commonly Used Types: -System.ValueTuple -System.ValueTuple -System.ValueTuple -System.ValueTuple -System.ValueTuple -System.ValueTuple -System.ValueTuple -System.ValueTuple -System.ValueTuple - -30ab651fcb4354552bd4891619a0bdd81e0ebdbf -When using NuGet 3.x this package requires at least version 3.4. - -Remarks ------------ -no remarks - - -Dependencies 0 ------------ - - -*This page was generated by a tool.* \ No newline at end of file diff --git a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/remarks.md b/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/remarks.md deleted file mode 100644 index e69de29b..00000000 diff --git a/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/third-party-notices.txt b/Build/third-party-libraries/packages/nuget.org/system.valuetuple/4.5.0/third-party-notices.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/Build/third-party-libraries/readme.md b/Build/third-party-libraries/readme.md index 158778a0..2d4b39cd 100644 --- a/Build/third-party-libraries/readme.md +++ b/Build/third-party-libraries/readme.md @@ -6,69 +6,66 @@ Licenses |[Apache-2.0](licenses/apache-2.0)|no|no|3| |[BSD-2-Clause](licenses/bsd-2-clause)|no|no|1| |[BSD-3-Clause](licenses/bsd-3-clause)|no|no|1| -|[MIT](licenses/mit)|no|no|41| +|[MIT](licenses/mit)|no|no|38| |[ms-net-library](licenses/ms-net-library)|no|no|6| |[PostgreSQL](licenses/postgresql)|no|no|1| -Packages 53 +Packages 50 -------- |Name|Version|Source|License|Used by| |----------|:----|:----|:----|:----| -|[Castle.Core](packages/nuget.org/castle.core/5.1.0)|5.1.0|[nuget.org](https://www.nuget.org/packages/Castle.Core/5.1.0)|[Apache-2.0](licenses/apache-2.0)|SqlDatabase internal| -|[Dapper.StrongName](packages/nuget.org/dapper.strongname/2.0.123)|2.0.123|[nuget.org](https://www.nuget.org/packages/Dapper.StrongName/2.0.123)|[Apache-2.0](licenses/apache-2.0)|SqlDatabase internal| -|[DiffEngine](packages/nuget.org/diffengine/10.0.0)|10.0.0|[nuget.org](https://www.nuget.org/packages/DiffEngine/10.0.0)|[MIT](licenses/mit)|SqlDatabase internal| -|[EmptyFiles](packages/nuget.org/emptyfiles/2.8.0)|2.8.0|[nuget.org](https://www.nuget.org/packages/EmptyFiles/2.8.0)|[MIT](licenses/mit)|SqlDatabase internal| -|[Microsoft.CodeCoverage](packages/nuget.org/microsoft.codecoverage/17.4.0)|17.4.0|[nuget.org](https://www.nuget.org/packages/Microsoft.CodeCoverage/17.4.0)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| -|[Microsoft.NET.Test.Sdk](packages/nuget.org/microsoft.net.test.sdk/17.4.0)|17.4.0|[nuget.org](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.4.0)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| -|[Microsoft.TestPlatform.ObjectModel](packages/nuget.org/microsoft.testplatform.objectmodel/17.4.0)|17.4.0|[nuget.org](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.4.0)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| -|[Microsoft.TestPlatform.TestHost](packages/nuget.org/microsoft.testplatform.testhost/17.4.0)|17.4.0|[nuget.org](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.4.0)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| +|[Castle.Core](packages/nuget.org/castle.core/5.1.1)|5.1.1|[nuget.org](https://www.nuget.org/packages/Castle.Core/5.1.1)|[Apache-2.0](licenses/apache-2.0)|SqlDatabase internal| +|[Dapper.StrongName](packages/nuget.org/dapper.strongname/2.1.15)|2.1.15|[nuget.org](https://www.nuget.org/packages/Dapper.StrongName/2.1.15)|[Apache-2.0](licenses/apache-2.0)|SqlDatabase internal| +|[DiffEngine](packages/nuget.org/diffengine/11.3.0)|11.3.0|[nuget.org](https://www.nuget.org/packages/DiffEngine/11.3.0)|[MIT](licenses/mit)|SqlDatabase internal| +|[EmptyFiles](packages/nuget.org/emptyfiles/4.4.0)|4.4.0|[nuget.org](https://www.nuget.org/packages/EmptyFiles/4.4.0)|[MIT](licenses/mit)|SqlDatabase internal| +|[Microsoft.CodeCoverage](packages/nuget.org/microsoft.codecoverage/17.7.2)|17.7.2|[nuget.org](https://www.nuget.org/packages/Microsoft.CodeCoverage/17.7.2)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| +|[Microsoft.CSharp](packages/nuget.org/microsoft.csharp/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/Microsoft.CSharp/4.7.0)|[MIT](licenses/mit)|SqlDatabase internal| +|[Microsoft.NET.Test.Sdk](packages/nuget.org/microsoft.net.test.sdk/17.7.2)|17.7.2|[nuget.org](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.7.2)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| +|[Microsoft.TestPlatform.ObjectModel](packages/nuget.org/microsoft.testplatform.objectmodel/17.7.2)|17.7.2|[nuget.org](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.7.2)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| +|[Microsoft.TestPlatform.TestHost](packages/nuget.org/microsoft.testplatform.testhost/17.7.2)|17.7.2|[nuget.org](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.7.2)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| |[Microsoft.Win32.Registry](packages/nuget.org/microsoft.win32.registry/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/Microsoft.Win32.Registry/4.7.0)|[MIT](licenses/mit)|SqlDatabase| -|[Microsoft.Win32.Registry](packages/nuget.org/microsoft.win32.registry/5.0.0)|5.0.0|[nuget.org](https://www.nuget.org/packages/Microsoft.Win32.Registry/5.0.0)|[MIT](licenses/mit)|SqlDatabase internal| -|[Microsoft.WSMan.Runtime](packages/nuget.org/microsoft.wsman.runtime/7.0.5)|7.0.5|[nuget.org](https://www.nuget.org/packages/Microsoft.WSMan.Runtime/7.0.5)|[MIT](licenses/mit)|SqlDatabase| -|[Microsoft.WSMan.Runtime](packages/nuget.org/microsoft.wsman.runtime/7.1.2)|7.1.2|[nuget.org](https://www.nuget.org/packages/Microsoft.WSMan.Runtime/7.1.2)|[MIT](licenses/mit)|SqlDatabase| |[Microsoft.WSMan.Runtime](packages/nuget.org/microsoft.wsman.runtime/7.2.0)|7.2.0|[nuget.org](https://www.nuget.org/packages/Microsoft.WSMan.Runtime/7.2.0)|[MIT](licenses/mit)|SqlDatabase| |[Microsoft.WSMan.Runtime](packages/nuget.org/microsoft.wsman.runtime/7.3.0)|7.3.0|[nuget.org](https://www.nuget.org/packages/Microsoft.WSMan.Runtime/7.3.0)|[MIT](licenses/mit)|SqlDatabase| -|[Moq](packages/nuget.org/moq/4.18.2)|4.18.2|[nuget.org](https://www.nuget.org/packages/Moq/4.18.2)|[BSD-3-Clause](licenses/bsd-3-clause)|SqlDatabase internal| +|[Moq](packages/nuget.org/moq/4.20.69)|4.20.69|[nuget.org](https://www.nuget.org/packages/Moq/4.20.69)|[BSD-3-Clause](licenses/bsd-3-clause)|SqlDatabase internal| |[MySqlConnector](packages/nuget.org/mysqlconnector/1.3.10)|1.3.10|[nuget.org](https://www.nuget.org/packages/MySqlConnector/1.3.10)|[MIT](licenses/mit)|SqlDatabase| |[NETStandard.Library](packages/nuget.org/netstandard.library/2.0.3)|2.0.3|[nuget.org](https://www.nuget.org/packages/NETStandard.Library/2.0.3)|[MIT](licenses/mit)|SqlDatabase| -|[Newtonsoft.Json](packages/nuget.org/newtonsoft.json/13.0.2)|13.0.2|[nuget.org](https://www.nuget.org/packages/Newtonsoft.Json/13.0.2)|[MIT](licenses/mit)|SqlDatabase internal| +|[Newtonsoft.Json](packages/nuget.org/newtonsoft.json/13.0.1)|13.0.1|[nuget.org](https://www.nuget.org/packages/Newtonsoft.Json/13.0.1)|[MIT](licenses/mit)|SqlDatabase internal| +|[Newtonsoft.Json](packages/nuget.org/newtonsoft.json/13.0.3)|13.0.3|[nuget.org](https://www.nuget.org/packages/Newtonsoft.Json/13.0.3)|[MIT](licenses/mit)|SqlDatabase internal| |[Npgsql](packages/nuget.org/npgsql/4.0.11)|4.0.11|[nuget.org](https://www.nuget.org/packages/Npgsql/4.0.11)|[PostgreSQL](licenses/postgresql)|SqlDatabase| -|[NuGet.Frameworks](packages/nuget.org/nuget.frameworks/5.11.0)|5.11.0|[nuget.org](https://www.nuget.org/packages/NuGet.Frameworks/5.11.0)|[Apache-2.0](licenses/apache-2.0)|SqlDatabase internal| -|[NUnit](packages/nuget.org/nunit/3.13.3)|3.13.3|[nuget.org](https://www.nuget.org/packages/NUnit/3.13.3)|[MIT](licenses/mit)|SqlDatabase internal| -|[NUnit3TestAdapter](packages/nuget.org/nunit3testadapter/4.3.1)|4.3.1|[nuget.org](https://www.nuget.org/packages/NUnit3TestAdapter/4.3.1)|[MIT](licenses/mit)|SqlDatabase internal| +|[NuGet.Frameworks](packages/nuget.org/nuget.frameworks/6.5.0)|6.5.0|[nuget.org](https://www.nuget.org/packages/NuGet.Frameworks/6.5.0)|[Apache-2.0](licenses/apache-2.0)|SqlDatabase internal| +|[NUnit](packages/nuget.org/nunit/3.14.0)|3.14.0|[nuget.org](https://www.nuget.org/packages/NUnit/3.14.0)|[MIT](licenses/mit)|SqlDatabase internal| +|[NUnit3TestAdapter](packages/nuget.org/nunit3testadapter/4.5.0)|4.5.0|[nuget.org](https://www.nuget.org/packages/NUnit3TestAdapter/4.5.0)|[MIT](licenses/mit)|SqlDatabase internal| |[PowerShellStandard.Library](packages/nuget.org/powershellstandard.library/5.1.0)|5.1.0|[nuget.org](https://www.nuget.org/packages/PowerShellStandard.Library/5.1.0)|[MIT](licenses/mit)|SqlDatabase| -|[Shouldly](packages/nuget.org/shouldly/4.1.0)|4.1.0|[nuget.org](https://www.nuget.org/packages/Shouldly/4.1.0)|[BSD-2-Clause](licenses/bsd-2-clause)|SqlDatabase internal| -|[StyleCop.Analyzers.Unstable](packages/nuget.org/stylecop.analyzers.unstable/1.2.0.435)|1.2.0.435|[nuget.org](https://www.nuget.org/packages/StyleCop.Analyzers.Unstable/1.2.0.435)|[MIT](licenses/mit)|SqlDatabase internal| +|[Shouldly](packages/nuget.org/shouldly/4.2.1)|4.2.1|[nuget.org](https://www.nuget.org/packages/Shouldly/4.2.1)|[BSD-2-Clause](licenses/bsd-2-clause)|SqlDatabase internal| +|[StyleCop.Analyzers.Unstable](packages/nuget.org/stylecop.analyzers.unstable/1.2.0.507)|1.2.0.507|[nuget.org](https://www.nuget.org/packages/StyleCop.Analyzers.Unstable/1.2.0.507)|[MIT](licenses/mit)|SqlDatabase internal| |[System.Buffers](packages/nuget.org/system.buffers/4.4.0)|4.4.0|[nuget.org](https://www.nuget.org/packages/System.Buffers/4.4.0)|[MIT](licenses/mit)|SqlDatabase| |[System.Buffers](packages/nuget.org/system.buffers/4.5.1)|4.5.1|[nuget.org](https://www.nuget.org/packages/System.Buffers/4.5.1)|[MIT](licenses/mit)|SqlDatabase| -|[System.CodeDom](packages/nuget.org/system.codedom/5.0.0)|5.0.0|[nuget.org](https://www.nuget.org/packages/System.CodeDom/5.0.0)|[MIT](licenses/mit)|SqlDatabase internal| -|[System.Configuration.ConfigurationManager](packages/nuget.org/system.configuration.configurationmanager/4.5.0)|4.5.0|[nuget.org](https://www.nuget.org/packages/System.Configuration.ConfigurationManager/4.5.0)|[MIT](licenses/mit)|SqlDatabase| +|[System.CodeDom](packages/nuget.org/system.codedom/6.0.0)|6.0.0|[nuget.org](https://www.nuget.org/packages/System.CodeDom/6.0.0)|[MIT](licenses/mit)|SqlDatabase internal| |[System.Data.SqlClient](packages/nuget.org/system.data.sqlclient/4.8.5)|4.8.5|[nuget.org](https://www.nuget.org/packages/System.Data.SqlClient/4.8.5)|[MIT](licenses/mit)|SqlDatabase| |[System.Diagnostics.DiagnosticSource](packages/nuget.org/system.diagnostics.diagnosticsource/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Diagnostics.DiagnosticSource/4.7.0)|[MIT](licenses/mit)|SqlDatabase| |[System.Diagnostics.EventLog](packages/nuget.org/system.diagnostics.eventlog/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Diagnostics.EventLog/4.7.0)|[MIT](licenses/mit)|SqlDatabase internal| -|[System.Diagnostics.EventLog](packages/nuget.org/system.diagnostics.eventlog/6.0.0)|6.0.0|[nuget.org](https://www.nuget.org/packages/System.Diagnostics.EventLog/6.0.0)|[MIT](licenses/mit)|SqlDatabase internal| -|[System.Management](packages/nuget.org/system.management/5.0.0)|5.0.0|[nuget.org](https://www.nuget.org/packages/System.Management/5.0.0)|[MIT](licenses/mit)|SqlDatabase internal| +|[System.Management](packages/nuget.org/system.management/6.0.1)|6.0.1|[nuget.org](https://www.nuget.org/packages/System.Management/6.0.1)|[MIT](licenses/mit)|SqlDatabase internal| +|[System.Memory](packages/nuget.org/system.memory/4.5.0)|4.5.0|[nuget.org](https://www.nuget.org/packages/System.Memory/4.5.0)|[MIT](licenses/mit)|SqlDatabase| |[System.Memory](packages/nuget.org/system.memory/4.5.3)|4.5.3|[nuget.org](https://www.nuget.org/packages/System.Memory/4.5.3)|[MIT](licenses/mit)|SqlDatabase| |[System.Memory](packages/nuget.org/system.memory/4.5.4)|4.5.4|[nuget.org](https://www.nuget.org/packages/System.Memory/4.5.4)|[MIT](licenses/mit)|SqlDatabase| +|[System.Memory](packages/nuget.org/system.memory/4.5.5)|4.5.5|[nuget.org](https://www.nuget.org/packages/System.Memory/4.5.5)|[MIT](licenses/mit)|SqlDatabase internal| |[System.Numerics.Vectors](packages/nuget.org/system.numerics.vectors/4.4.0)|4.4.0|[nuget.org](https://www.nuget.org/packages/System.Numerics.Vectors/4.4.0)|[MIT](licenses/mit)|SqlDatabase| +|[System.Reflection.Emit](packages/nuget.org/system.reflection.emit/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Reflection.Emit/4.7.0)|[MIT](licenses/mit)|SqlDatabase internal| +|[System.Reflection.Emit.ILGeneration](packages/nuget.org/system.reflection.emit.ilgeneration/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Reflection.Emit.ILGeneration/4.7.0)|[MIT](licenses/mit)|SqlDatabase internal| |[System.Reflection.Metadata](packages/nuget.org/system.reflection.metadata/1.6.0)|1.6.0|[nuget.org](https://www.nuget.org/packages/System.Reflection.Metadata/1.6.0)|[MIT](licenses/mit)|SqlDatabase internal| +|[System.Runtime.CompilerServices.Unsafe](packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.0)|4.5.0|[nuget.org](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/4.5.0)|[MIT](licenses/mit)|SqlDatabase| |[System.Runtime.CompilerServices.Unsafe](packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.2)|4.5.2|[nuget.org](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/4.5.2)|[MIT](licenses/mit)|SqlDatabase| |[System.Runtime.CompilerServices.Unsafe](packages/nuget.org/system.runtime.compilerservices.unsafe/4.5.3)|4.5.3|[nuget.org](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/4.5.3)|[MIT](licenses/mit)|SqlDatabase internal| |[System.Runtime.CompilerServices.Unsafe](packages/nuget.org/system.runtime.compilerservices.unsafe/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/4.7.0)|[MIT](licenses/mit)|SqlDatabase| -|[System.Runtime.InteropServices.RuntimeInformation](packages/nuget.org/system.runtime.interopservices.runtimeinformation/4.3.0)|4.3.0|[nuget.org](https://www.nuget.org/packages/System.Runtime.InteropServices.RuntimeInformation/4.3.0)|[ms-net-library](licenses/ms-net-library)|SqlDatabase internal| |[System.Runtime.Loader](packages/nuget.org/system.runtime.loader/4.3.0)|4.3.0|[nuget.org](https://www.nuget.org/packages/System.Runtime.Loader/4.3.0)|[ms-net-library](licenses/ms-net-library)|SqlDatabase| |[System.Security.AccessControl](packages/nuget.org/system.security.accesscontrol/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Security.AccessControl/4.7.0)|[MIT](licenses/mit)|SqlDatabase| -|[System.Security.AccessControl](packages/nuget.org/system.security.accesscontrol/5.0.0)|5.0.0|[nuget.org](https://www.nuget.org/packages/System.Security.AccessControl/5.0.0)|[MIT](licenses/mit)|SqlDatabase internal| -|[System.Security.Cryptography.ProtectedData](packages/nuget.org/system.security.cryptography.protecteddata/4.5.0)|4.5.0|[nuget.org](https://www.nuget.org/packages/System.Security.Cryptography.ProtectedData/4.5.0)|[MIT](licenses/mit)|SqlDatabase| -|[System.Security.Permissions](packages/nuget.org/system.security.permissions/4.5.0)|4.5.0|[nuget.org](https://www.nuget.org/packages/System.Security.Permissions/4.5.0)|[MIT](licenses/mit)|SqlDatabase| |[System.Security.Principal.Windows](packages/nuget.org/system.security.principal.windows/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Security.Principal.Windows/4.7.0)|[MIT](licenses/mit)|SqlDatabase| -|[System.Security.Principal.Windows](packages/nuget.org/system.security.principal.windows/5.0.0)|5.0.0|[nuget.org](https://www.nuget.org/packages/System.Security.Principal.Windows/5.0.0)|[MIT](licenses/mit)|SqlDatabase internal| |[System.Text.Encoding.CodePages](packages/nuget.org/system.text.encoding.codepages/4.7.0)|4.7.0|[nuget.org](https://www.nuget.org/packages/System.Text.Encoding.CodePages/4.7.0)|[MIT](licenses/mit)|SqlDatabase| +|[System.Threading.Tasks.Extensions](packages/nuget.org/system.threading.tasks.extensions/4.3.0)|4.3.0|[nuget.org](https://www.nuget.org/packages/System.Threading.Tasks.Extensions/4.3.0)|[ms-net-library](licenses/ms-net-library)|SqlDatabase| |[System.Threading.Tasks.Extensions](packages/nuget.org/system.threading.tasks.extensions/4.5.2)|4.5.2|[nuget.org](https://www.nuget.org/packages/System.Threading.Tasks.Extensions/4.5.2)|[MIT](licenses/mit)|SqlDatabase| |[System.Threading.Tasks.Extensions](packages/nuget.org/system.threading.tasks.extensions/4.5.4)|4.5.4|[nuget.org](https://www.nuget.org/packages/System.Threading.Tasks.Extensions/4.5.4)|[MIT](licenses/mit)|SqlDatabase internal| -|[System.ValueTuple](packages/nuget.org/system.valuetuple/4.5.0)|4.5.0|[nuget.org](https://www.nuget.org/packages/System.ValueTuple/4.5.0)|[MIT](licenses/mit)|SqlDatabase| *This page was generated by [ThirdPartyLibraries.GlobalTool](https://github.com/max-ieremenko/ThirdPartyLibraries).* \ No newline at end of file diff --git a/Examples/CSharpMirationStep/CSharpMirationStep.csproj b/Examples/CSharpMirationStep/CSharpMirationStep.csproj index 1f0d1218..3b11ece2 100644 --- a/Examples/CSharpMirationStep/CSharpMirationStep.csproj +++ b/Examples/CSharpMirationStep/CSharpMirationStep.csproj @@ -1,7 +1,7 @@ - net452 + net472 2.1_2.2 diff --git a/Examples/CSharpMirationStep/readme.md b/Examples/CSharpMirationStep/readme.md index e142106a..fffbd9d3 100644 --- a/Examples/CSharpMirationStep/readme.md +++ b/Examples/CSharpMirationStep/readme.md @@ -3,13 +3,13 @@ Any assembly script is -- .exe or .dll for target framework is 4.5.2+ -- .dll for .net 7.0, 6.0, 5.0 or .net core 3.1 +- .exe or .dll for target framework is 4.7.2+ +- .dll for .net 6.0+ - has exactly one class with script implementation This project is an example of script implementation. -The build output is 2.1_2.2.dll with target framework 4.5.2. -Due to the current dependencies, 2.1_2.2.dll works well on .net 7.0 - .net core 3.1. +The build output is 2.1_2.2.dll with target framework 4.7.2. +Due to the current dependencies, 2.1_2.2.dll works well on .net 6.0+. ## Script source @@ -81,7 +81,7 @@ After the migration step is finished or failed - the domain will be unloaded - temporary directory will be deleted -## Runtime .NET Core +## Runtime .NET At runtime the assembly will be loaded into the current application domain (`AssemblyLoadContext.Default`). diff --git a/Examples/PackageManagerConsole/SolutionScripts/SolutionScripts.csproj b/Examples/PackageManagerConsole/SolutionScripts/SolutionScripts.csproj index d8e0fab3..d1629d38 100644 --- a/Examples/PackageManagerConsole/SolutionScripts/SolutionScripts.csproj +++ b/Examples/PackageManagerConsole/SolutionScripts/SolutionScripts.csproj @@ -1,6 +1,6 @@  - net452 + net472 false true AnyCPU @@ -10,7 +10,7 @@ - + diff --git a/Examples/PackageManagerConsole/SolutionScripts/SqlDatabase.config b/Examples/PackageManagerConsole/SolutionScripts/SqlDatabase.config index f6c9ad9c..9f051d6c 100644 --- a/Examples/PackageManagerConsole/SolutionScripts/SqlDatabase.config +++ b/Examples/PackageManagerConsole/SolutionScripts/SqlDatabase.config @@ -12,6 +12,6 @@ + sku=".NETFramework,Version=v4.7.2" /> \ No newline at end of file diff --git a/Examples/PowerShellScript/readme.md b/Examples/PowerShellScript/readme.md index fd83bf0b..44a06a19 100644 --- a/Examples/PowerShellScript/readme.md +++ b/Examples/PowerShellScript/readme.md @@ -61,22 +61,20 @@ use The version with which you run the module. -### .net framework 4.5.2 +### .net framework 4.7.2 -[![NuGet](https://img.shields.io/nuget/v/SqlDatabase.svg?style=flat-square&label=nuget%20net%204.5.2)](https://www.nuget.org/packages/SqlDatabase/) +[![NuGet](https://img.shields.io/nuget/v/SqlDatabase.svg?style=flat-square&label=nuget%20net%204.7.2)](https://www.nuget.org/packages/SqlDatabase/) Installed Powershell Desktop version. -### .net SDK tool for .net 5.0/6.0 or .net core 3.1 +### .net SDK tool for .net 6.0+ [![NuGet](https://img.shields.io/nuget/v/SqlDatabase.GlobalTool.svg?style=flat-square&label=nuget%20dotnet%20tool)](https://www.nuget.org/packages/SqlDatabase.GlobalTool/) Pre-installed Powershell Core is required, will be used by SqlDatabase as external component. Due to the Powershell Core design: -* SqlDatabase .net 7.0 can host Powershell Core versions below 7.4 +* SqlDatabase .net 8.0 and 7.0 can host Powershell Core versions below 7.4 * SqlDatabase .net 6.0 can host Powershell Core versions below 7.3 -* .net 5.0 can host Powershell Core versions below 7.2 -* .net core 3.1 below 7.1 PowerShell location can be passed via command line: diff --git a/Examples/SqlServerDockerImage/create-database.dockerfile b/Examples/SqlServerDockerImage/create-database.dockerfile index 2a820422..2cf2e4a6 100644 --- a/Examples/SqlServerDockerImage/create-database.dockerfile +++ b/Examples/SqlServerDockerImage/create-database.dockerfile @@ -7,11 +7,11 @@ ENV ACCEPT_EULA=Y \ # copy scripts COPY create-database-scripts/ /sql-scripts/ -# install .net 5.0 sdk +# install .net 6.0 sdk RUN apt-get update && \ apt-get install -y apt-transport-https && \ apt-get update && \ - apt-get install -y dotnet-sdk-5.0 + apt-get install -y dotnet-sdk-6.0 # install SqlDatabase.GlobalTool RUN dotnet tool install --global SqlDatabase.GlobalTool diff --git a/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile b/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile index 3f65ada3..1b4fba3e 100644 --- a/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile +++ b/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile @@ -4,11 +4,11 @@ FROM sqldatabase/mssql-server-linux-demo:create AS build # copy scripts COPY upgrade-database-scripts/ /sql-scripts/ -# install .net 5.0 sdk +# install .net 6.0 sdk RUN apt-get update && \ apt-get install -y apt-transport-https && \ apt-get update && \ - apt-get install -y dotnet-sdk-5.0 + apt-get install -y dotnet-sdk-6.0 # install SqlDatabase.GlobalTool RUN dotnet tool install --global SqlDatabase.GlobalTool diff --git a/LICENSE.md b/LICENSE.md index 2aefa8f2..f6d2bfe7 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2021 max-ieremenko +Copyright (c) 2018-2023 max-ieremenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 78d5941c..4b05e83c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ SqlDatabase =========== -[![NuGet](https://img.shields.io/nuget/v/SqlDatabase.svg?style=flat-square&label=nuget%20net%204.5.2)](https://www.nuget.org/packages/SqlDatabase/) +[![NuGet](https://img.shields.io/nuget/v/SqlDatabase.svg?style=flat-square&label=nuget%20net%204.7.2)](https://www.nuget.org/packages/SqlDatabase/) [![NuGet](https://img.shields.io/nuget/v/SqlDatabase.GlobalTool.svg?style=flat-square&label=nuget%20dotnet%20tool)](https://www.nuget.org/packages/SqlDatabase.GlobalTool/) [![PowerShell Gallery](https://img.shields.io/powershellgallery/v/SqlDatabase.svg?style=flat-square)](https://www.powershellgallery.com/packages/SqlDatabase) [![GitHub release](https://img.shields.io/github/release/max-ieremenko/SqlDatabase.svg?style=flat-square&label=manual%20download)](https://github.com/max-ieremenko/SqlDatabase/releases) @@ -41,9 +41,9 @@ Installation PowerShell module is compatible with Powershell Core 6.1+ and PowerShell Desktop 5.1. -.net tool is compatible with .net sdk 7.0, 6.0, 5.0 and .net core 3.1. +.net tool is compatible with .net sdk 8.0, 7.0, and 6.0. -Command-line tool is compatible with .net runtime 7.0, 6.0, 5.0, .net core runtime 3.1 and .net framework 4.5.2+. +Command-line tool is compatible with .net runtime 8.0, 7.0, 6.0 and .net framework 4.7.2+. ### PowerShell, from gallery diff --git a/Sources/Dependencies/System.Management.Automation.dll b/Sources/Dependencies/System.Management.Automation.dll deleted file mode 100644 index 3ca6528d..00000000 Binary files a/Sources/Dependencies/System.Management.Automation.dll and /dev/null differ diff --git a/Sources/Directory.Build.props b/Sources/Directory.Build.props index a7fec37a..72014747 100644 --- a/Sources/Directory.Build.props +++ b/Sources/Directory.Build.props @@ -1,6 +1,6 @@ - false + true true AnyCPU @@ -8,18 +8,35 @@ true ..\SqlDatabase.snk latest + enable false en false + true - - - + + 4.2.0 + $(SqlDatabaseVersion) + $(SqlDatabaseVersion).0 + $(SqlDatabaseVersion).0 + SqlDatabase + Max Ieremenko + SqlDatabase is a tool for MSSQL Server, PostgreSQL and MySQL, allows executing scripts, database migrations and data export. + https://github.com/max-ieremenko/SqlDatabase/releases + https://github.com/max-ieremenko/SqlDatabase + https://github.com/max-ieremenko/SqlDatabase + https://github.com/max-ieremenko/SqlDatabase/raw/master/icon-32.png + icon-32.png + MIT + (C) 2018-2023 Max Ieremenko. + git + sqlserver database postgresql mysql mysql-database sqlcmd migration-tool c-sharp command-line-tool miration-step sql-script sql-database database-migrations export-data + false + - + - \ No newline at end of file diff --git a/Sources/Directory.Packages.props b/Sources/Directory.Packages.props new file mode 100644 index 00000000..7f87a2a5 --- /dev/null +++ b/Sources/Directory.Packages.props @@ -0,0 +1,27 @@ + + + true + true + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/Docker/docker-compose.yml b/Sources/Docker/docker-compose.yml new file mode 100644 index 00000000..00319a8c --- /dev/null +++ b/Sources/Docker/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3" +services: + mssql: + image: sqldatabase/mssql:2017 + restart: always + ports: + - 1433:1433 + + pgsql: + image: sqldatabase/postgres:13.3 + restart: always + ports: + - 5432:5432 + + mysql: + image: sqldatabase/mysql:8.0.25 + restart: always + ports: + - 3306:3306 diff --git a/Build/image-dotnet-runtime-6.0.dockerfile b/Sources/Docker/image-dotnet-runtime-6.0.dockerfile similarity index 100% rename from Build/image-dotnet-runtime-6.0.dockerfile rename to Sources/Docker/image-dotnet-runtime-6.0.dockerfile diff --git a/Build/image-dotnet-runtime-7.0.dockerfile b/Sources/Docker/image-dotnet-runtime-7.0.dockerfile similarity index 100% rename from Build/image-dotnet-runtime-7.0.dockerfile rename to Sources/Docker/image-dotnet-runtime-7.0.dockerfile diff --git a/Sources/Docker/image-dotnet-runtime-8.0.dockerfile b/Sources/Docker/image-dotnet-runtime-8.0.dockerfile new file mode 100644 index 00000000..e1bb2bb7 --- /dev/null +++ b/Sources/Docker/image-dotnet-runtime-8.0.dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/dotnet/runtime:8.0 + +RUN apt-get update && \ + apt-get install -y curl && \ + curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.3.9/powershell_7.3.9-1.deb_amd64.deb --output powershell.deb && \ + dpkg -i powershell.deb && \ + apt-get install -f && \ + rm -f powershell.deb \ No newline at end of file diff --git a/Build/image-dotnet-sdk-6.0.dockerfile b/Sources/Docker/image-dotnet-sdk-6.0.dockerfile similarity index 100% rename from Build/image-dotnet-sdk-6.0.dockerfile rename to Sources/Docker/image-dotnet-sdk-6.0.dockerfile diff --git a/Build/image-dotnet-sdk-7.0.dockerfile b/Sources/Docker/image-dotnet-sdk-7.0.dockerfile similarity index 100% rename from Build/image-dotnet-sdk-7.0.dockerfile rename to Sources/Docker/image-dotnet-sdk-7.0.dockerfile diff --git a/Sources/Docker/image-dotnet-sdk-8.0.dockerfile b/Sources/Docker/image-dotnet-sdk-8.0.dockerfile new file mode 100644 index 00000000..e8a8bc5e --- /dev/null +++ b/Sources/Docker/image-dotnet-sdk-8.0.dockerfile @@ -0,0 +1,7 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 + +RUN apt-get update && \ + curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.3.9/powershell_7.3.9-1.deb_amd64.deb --output powershell.deb && \ + dpkg -i powershell.deb && \ + apt-get install -f && \ + rm -f powershell.deb \ No newline at end of file diff --git a/Build/image-mssql-2017.dockerfile b/Sources/Docker/image-mssql-2017.dockerfile similarity index 100% rename from Build/image-mssql-2017.dockerfile rename to Sources/Docker/image-mssql-2017.dockerfile diff --git a/Build/image-mysql-8025.dockerfile b/Sources/Docker/image-mysql-8025.dockerfile similarity index 100% rename from Build/image-mysql-8025.dockerfile rename to Sources/Docker/image-mysql-8025.dockerfile diff --git a/Build/image-postgres-133.dockerfile b/Sources/Docker/image-postgres-133.dockerfile similarity index 100% rename from Build/image-postgres-133.dockerfile rename to Sources/Docker/image-postgres-133.dockerfile diff --git a/Sources/SqlDatabase.Test/Docker/mssql.create-database.sql b/Sources/Docker/mssql.create-database.sql similarity index 100% rename from Sources/SqlDatabase.Test/Docker/mssql.create-database.sql rename to Sources/Docker/mssql.create-database.sql diff --git a/Sources/SqlDatabase.Test/Docker/mysql.create-database.sql b/Sources/Docker/mysql.create-database.sql similarity index 100% rename from Sources/SqlDatabase.Test/Docker/mysql.create-database.sql rename to Sources/Docker/mysql.create-database.sql diff --git a/Sources/SqlDatabase.Test/Docker/pgsql.create-database.sql b/Sources/Docker/pgsql.create-database.sql similarity index 100% rename from Sources/SqlDatabase.Test/Docker/pgsql.create-database.sql rename to Sources/Docker/pgsql.create-database.sql diff --git a/Sources/GlobalAssemblyInfo.cs b/Sources/GlobalAssemblyInfo.cs deleted file mode 100644 index fd05e8aa..00000000 --- a/Sources/GlobalAssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SqlDatabase")] -[assembly: AssemblyCopyright("Copyright � 2018-2022 Max Ieremenko")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] - -[assembly: AssemblyVersion("4.1.1.0")] -[assembly: AssemblyFileVersion("4.1.1.0")] diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Execute/drop.database.sql b/Sources/IntegrationTests/MsSql/Execute/drop.database.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Execute/drop.database.sql rename to Sources/IntegrationTests/MsSql/Execute/drop.database.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Export/export.sql b/Sources/IntegrationTests/MsSql/Export/export.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Export/export.sql rename to Sources/IntegrationTests/MsSql/Export/export.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/01.Tables/01.Person.sql b/Sources/IntegrationTests/MsSql/New/01.Tables/01.Person.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/01.Tables/01.Person.sql rename to Sources/IntegrationTests/MsSql/New/01.Tables/01.Person.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/01.Tables/02.PersonAddress.sql b/Sources/IntegrationTests/MsSql/New/01.Tables/02.PersonAddress.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/01.Tables/02.PersonAddress.sql rename to Sources/IntegrationTests/MsSql/New/01.Tables/02.PersonAddress.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/01.create.sql b/Sources/IntegrationTests/MsSql/New/01.create.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/01.create.sql rename to Sources/IntegrationTests/MsSql/New/01.create.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/02.Data/01.Person.sql b/Sources/IntegrationTests/MsSql/New/02.Data/01.Person.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/02.Data/01.Person.sql rename to Sources/IntegrationTests/MsSql/New/02.Data/01.Person.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/02.Data/02.PersonAddress.sql b/Sources/IntegrationTests/MsSql/New/02.Data/02.PersonAddress.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/02.Data/02.PersonAddress.sql rename to Sources/IntegrationTests/MsSql/New/02.Data/02.PersonAddress.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/02.schemas.ps1 b/Sources/IntegrationTests/MsSql/New/02.schemas.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/02.schemas.ps1 rename to Sources/IntegrationTests/MsSql/New/02.schemas.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/03.version.sql b/Sources/IntegrationTests/MsSql/New/03.version.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/New/03.version.sql rename to Sources/IntegrationTests/MsSql/New/03.version.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Test.ps1 b/Sources/IntegrationTests/MsSql/Test.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Test.ps1 rename to Sources/IntegrationTests/MsSql/Test.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Test.sh b/Sources/IntegrationTests/MsSql/Test.sh similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Test.sh rename to Sources/IntegrationTests/MsSql/Test.sh diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/TestGlobalTool.sh b/Sources/IntegrationTests/MsSql/TestGlobalTool.sh similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/TestGlobalTool.sh rename to Sources/IntegrationTests/MsSql/TestGlobalTool.sh diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/TestPowerShell.ps1 b/Sources/IntegrationTests/MsSql/TestPowerShell.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/TestPowerShell.ps1 rename to Sources/IntegrationTests/MsSql/TestPowerShell.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/1.0_1.2.sql b/Sources/IntegrationTests/MsSql/Upgrade/1.0_1.2.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/1.0_1.2.sql rename to Sources/IntegrationTests/MsSql/Upgrade/1.0_1.2.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/1.2_2.0.ps1 b/Sources/IntegrationTests/MsSql/Upgrade/1.2_2.0.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/1.2_2.0.ps1 rename to Sources/IntegrationTests/MsSql/Upgrade/1.2_2.0.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/2.0_2.1.sql b/Sources/IntegrationTests/MsSql/Upgrade/2.0_2.1.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/2.0_2.1.sql rename to Sources/IntegrationTests/MsSql/Upgrade/2.0_2.1.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/SqlDatabase.exe.config b/Sources/IntegrationTests/MsSql/Upgrade/SqlDatabase.exe.config similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/Upgrade/SqlDatabase.exe.config rename to Sources/IntegrationTests/MsSql/Upgrade/SqlDatabase.exe.config diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/SqlDatabase.exe.config b/Sources/IntegrationTests/MsSql/UpgradeModularity/SqlDatabase.exe.config similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/SqlDatabase.exe.config rename to Sources/IntegrationTests/MsSql/UpgradeModularity/SqlDatabase.exe.config diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleA_1.0_2.0.sql b/Sources/IntegrationTests/MsSql/UpgradeModularity/moduleA_1.0_2.0.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleA_1.0_2.0.sql rename to Sources/IntegrationTests/MsSql/UpgradeModularity/moduleA_1.0_2.0.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleB_1.0_1.1.sql b/Sources/IntegrationTests/MsSql/UpgradeModularity/moduleB_1.0_1.1.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleB_1.0_1.1.sql rename to Sources/IntegrationTests/MsSql/UpgradeModularity/moduleB_1.0_1.1.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.ps1 b/Sources/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.ps1 rename to Sources/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.txt b/Sources/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.txt similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.txt rename to Sources/IntegrationTests/MsSql/UpgradeModularity/moduleC_1.0_2.0.txt diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Execute/drop.database.ps1 b/Sources/IntegrationTests/MySql/Execute/drop.database.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Execute/drop.database.ps1 rename to Sources/IntegrationTests/MySql/Execute/drop.database.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Export/export.sql b/Sources/IntegrationTests/MySql/Export/export.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Export/export.sql rename to Sources/IntegrationTests/MySql/Export/export.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/New/01.Tables/01.person.sql b/Sources/IntegrationTests/MySql/New/01.Tables/01.person.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/New/01.Tables/01.person.sql rename to Sources/IntegrationTests/MySql/New/01.Tables/01.person.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/New/01.Tables/02.person_address.sql b/Sources/IntegrationTests/MySql/New/01.Tables/02.person_address.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/New/01.Tables/02.person_address.sql rename to Sources/IntegrationTests/MySql/New/01.Tables/02.person_address.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/New/01.create.sql b/Sources/IntegrationTests/MySql/New/01.create.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/New/01.create.sql rename to Sources/IntegrationTests/MySql/New/01.create.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/New/02.Data/01.person.sql b/Sources/IntegrationTests/MySql/New/02.Data/01.person.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/New/02.Data/01.person.sql rename to Sources/IntegrationTests/MySql/New/02.Data/01.person.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/New/02.Data/02.person_address.sql b/Sources/IntegrationTests/MySql/New/02.Data/02.person_address.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/New/02.Data/02.person_address.sql rename to Sources/IntegrationTests/MySql/New/02.Data/02.person_address.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/New/05.version.sql b/Sources/IntegrationTests/MySql/New/05.version.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/New/05.version.sql rename to Sources/IntegrationTests/MySql/New/05.version.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Test.ps1 b/Sources/IntegrationTests/MySql/Test.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Test.ps1 rename to Sources/IntegrationTests/MySql/Test.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Test.sh b/Sources/IntegrationTests/MySql/Test.sh similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Test.sh rename to Sources/IntegrationTests/MySql/Test.sh diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/TestGlobalTool.sh b/Sources/IntegrationTests/MySql/TestGlobalTool.sh similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/TestGlobalTool.sh rename to Sources/IntegrationTests/MySql/TestGlobalTool.sh diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/TestPowerShell.ps1 b/Sources/IntegrationTests/MySql/TestPowerShell.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/TestPowerShell.ps1 rename to Sources/IntegrationTests/MySql/TestPowerShell.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/1.0_1.2.sql b/Sources/IntegrationTests/MySql/Upgrade/1.0_1.2.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/1.0_1.2.sql rename to Sources/IntegrationTests/MySql/Upgrade/1.0_1.2.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/1.2_2.0.ps1 b/Sources/IntegrationTests/MySql/Upgrade/1.2_2.0.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/1.2_2.0.ps1 rename to Sources/IntegrationTests/MySql/Upgrade/1.2_2.0.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/2.0_2.1.sql b/Sources/IntegrationTests/MySql/Upgrade/2.0_2.1.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/2.0_2.1.sql rename to Sources/IntegrationTests/MySql/Upgrade/2.0_2.1.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/SqlDatabase.exe.config b/Sources/IntegrationTests/MySql/Upgrade/SqlDatabase.exe.config similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/Upgrade/SqlDatabase.exe.config rename to Sources/IntegrationTests/MySql/Upgrade/SqlDatabase.exe.config diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/SqlDatabase.exe.config b/Sources/IntegrationTests/MySql/UpgradeModularity/SqlDatabase.exe.config similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/SqlDatabase.exe.config rename to Sources/IntegrationTests/MySql/UpgradeModularity/SqlDatabase.exe.config diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleA_1.0_2.0.sql b/Sources/IntegrationTests/MySql/UpgradeModularity/moduleA_1.0_2.0.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleA_1.0_2.0.sql rename to Sources/IntegrationTests/MySql/UpgradeModularity/moduleA_1.0_2.0.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleB_1.0_1.1.sql b/Sources/IntegrationTests/MySql/UpgradeModularity/moduleB_1.0_1.1.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleB_1.0_1.1.sql rename to Sources/IntegrationTests/MySql/UpgradeModularity/moduleB_1.0_1.1.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.ps1 b/Sources/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.ps1 rename to Sources/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.txt b/Sources/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.txt similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.txt rename to Sources/IntegrationTests/MySql/UpgradeModularity/moduleC_1.0_2.0.txt diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Execute/drop.database.ps1 b/Sources/IntegrationTests/PgSql/Execute/drop.database.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Execute/drop.database.ps1 rename to Sources/IntegrationTests/PgSql/Execute/drop.database.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Export/export.sql b/Sources/IntegrationTests/PgSql/Export/export.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Export/export.sql rename to Sources/IntegrationTests/PgSql/Export/export.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/01.Tables/01.person.sql b/Sources/IntegrationTests/PgSql/New/01.Tables/01.person.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/01.Tables/01.person.sql rename to Sources/IntegrationTests/PgSql/New/01.Tables/01.person.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/01.Tables/02.person_address.sql b/Sources/IntegrationTests/PgSql/New/01.Tables/02.person_address.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/01.Tables/02.person_address.sql rename to Sources/IntegrationTests/PgSql/New/01.Tables/02.person_address.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/01.drop.ps1 b/Sources/IntegrationTests/PgSql/New/01.drop.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/01.drop.ps1 rename to Sources/IntegrationTests/PgSql/New/01.drop.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/02.Data/01.person.sql b/Sources/IntegrationTests/PgSql/New/02.Data/01.person.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/02.Data/01.person.sql rename to Sources/IntegrationTests/PgSql/New/02.Data/01.person.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/02.Data/02.person_address.sql b/Sources/IntegrationTests/PgSql/New/02.Data/02.person_address.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/02.Data/02.person_address.sql rename to Sources/IntegrationTests/PgSql/New/02.Data/02.person_address.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/02.create.sql b/Sources/IntegrationTests/PgSql/New/02.create.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/02.create.sql rename to Sources/IntegrationTests/PgSql/New/02.create.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/03.database_properties.sql b/Sources/IntegrationTests/PgSql/New/03.database_properties.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/03.database_properties.sql rename to Sources/IntegrationTests/PgSql/New/03.database_properties.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/04.schemas.sql b/Sources/IntegrationTests/PgSql/New/04.schemas.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/04.schemas.sql rename to Sources/IntegrationTests/PgSql/New/04.schemas.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/05.version.sql b/Sources/IntegrationTests/PgSql/New/05.version.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/New/05.version.sql rename to Sources/IntegrationTests/PgSql/New/05.version.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Test.ps1 b/Sources/IntegrationTests/PgSql/Test.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Test.ps1 rename to Sources/IntegrationTests/PgSql/Test.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Test.sh b/Sources/IntegrationTests/PgSql/Test.sh similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Test.sh rename to Sources/IntegrationTests/PgSql/Test.sh diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/TestGlobalTool.sh b/Sources/IntegrationTests/PgSql/TestGlobalTool.sh similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/TestGlobalTool.sh rename to Sources/IntegrationTests/PgSql/TestGlobalTool.sh diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/TestPowerShell.ps1 b/Sources/IntegrationTests/PgSql/TestPowerShell.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/TestPowerShell.ps1 rename to Sources/IntegrationTests/PgSql/TestPowerShell.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/1.0_1.2.sql b/Sources/IntegrationTests/PgSql/Upgrade/1.0_1.2.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/1.0_1.2.sql rename to Sources/IntegrationTests/PgSql/Upgrade/1.0_1.2.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/1.2_2.0.ps1 b/Sources/IntegrationTests/PgSql/Upgrade/1.2_2.0.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/1.2_2.0.ps1 rename to Sources/IntegrationTests/PgSql/Upgrade/1.2_2.0.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/2.0_2.1.sql b/Sources/IntegrationTests/PgSql/Upgrade/2.0_2.1.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/2.0_2.1.sql rename to Sources/IntegrationTests/PgSql/Upgrade/2.0_2.1.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/SqlDatabase.exe.config b/Sources/IntegrationTests/PgSql/Upgrade/SqlDatabase.exe.config similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/Upgrade/SqlDatabase.exe.config rename to Sources/IntegrationTests/PgSql/Upgrade/SqlDatabase.exe.config diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/SqlDatabase.exe.config b/Sources/IntegrationTests/PgSql/UpgradeModularity/SqlDatabase.exe.config similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/SqlDatabase.exe.config rename to Sources/IntegrationTests/PgSql/UpgradeModularity/SqlDatabase.exe.config diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleA_1.0_2.0.sql b/Sources/IntegrationTests/PgSql/UpgradeModularity/moduleA_1.0_2.0.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleA_1.0_2.0.sql rename to Sources/IntegrationTests/PgSql/UpgradeModularity/moduleA_1.0_2.0.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleB_1.0_1.1.sql b/Sources/IntegrationTests/PgSql/UpgradeModularity/moduleB_1.0_1.1.sql similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleB_1.0_1.1.sql rename to Sources/IntegrationTests/PgSql/UpgradeModularity/moduleB_1.0_1.1.sql diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.ps1 b/Sources/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.ps1 rename to Sources/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.ps1 diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.txt b/Sources/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.txt similarity index 100% rename from Sources/SqlDatabase.Test/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.txt rename to Sources/IntegrationTests/PgSql/UpgradeModularity/moduleC_1.0_2.0.txt diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/AssemblyScriptFactoryTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/AssemblyScriptFactoryTest.cs new file mode 100644 index 00000000..cacb2657 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/AssemblyScriptFactoryTest.cs @@ -0,0 +1,52 @@ +using System.IO; +using Moq; +using NUnit.Framework; +using Shouldly; +using SqlDatabase.FileSystem; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Adapter.AssemblyScripts; + +[TestFixture] +public class AssemblyScriptFactoryTest +{ + private AssemblyScriptFactory _sut = null!; + + [SetUp] + public void BeforeEachTest() + { + _sut = new AssemblyScriptFactory("class-name", "method-name"); + } + + [Test] + [TestCase(".EXE", true)] + [TestCase(".dll", true)] + [TestCase(".sql", false)] + [TestCase(null, false)] + public void IsSupported(string? ext, bool expected) + { + var file = new Mock(MockBehavior.Strict); + file + .SetupGet(f => f.Extension) + .Returns(ext!); + + _sut.IsSupported(file.Object).ShouldBe(expected); + } + + [Test] + public void FromFile() + { + var file = FileFactory.File( + "11.dll", + new byte[] { 1, 2, 3 }, + FileFactory.Folder("name", FileFactory.File("11.txt", "3, 2, 1"))); + + var script = _sut.FromFile(file).ShouldBeOfType(); + + script.DisplayName.ShouldBe("11.dll"); + script.ClassName.ShouldBe("class-name"); + script.MethodName.ShouldBe("method-name"); + script.ReadAssemblyContent().ShouldBe(new byte[] { 1, 2, 3 }); + new StreamReader(script.ReadDescriptionContent()!).ReadToEnd().ShouldBe("3, 2, 1"); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyScriptTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/AssemblyScriptTest.cs similarity index 65% rename from Sources/SqlDatabase.Test/Scripts/AssemblyScriptTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/AssemblyScriptTest.cs index 84714044..0a1a2862 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyScriptTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/AssemblyScriptTest.cs @@ -6,26 +6,24 @@ using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Configuration; -using SqlDatabase.Scripts.AssemblyInternal; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public class AssemblyScriptTest { - private AssemblyScript _sut; - private Variables _variables; - private Mock _log; - private Mock _command; + private AssemblyScript _sut = null!; + private Mock _variables = null!; + private Mock _log = null!; + private Mock _command = null!; - private IList _logOutput; - private IList _executedScripts; + private IList _logOutput = null!; + private IList _executedScripts = null!; [SetUp] public void BeforeEachTest() { - _variables = new Variables(); + _variables = new Mock(MockBehavior.Strict); _logOutput = new List(); _log = new Mock(MockBehavior.Strict); @@ -41,27 +39,32 @@ public void BeforeEachTest() .Callback(() => _executedScripts.Add(_command.Object.CommandText)) .Returns(0); - _sut = new AssemblyScript(); - _sut.Configuration = new AssemblyScriptConfiguration(); + _sut = new AssemblyScript("dummy", null, null, null!, null!); } [Test] public void ExecuteExampleMsSql() { - _sut.Configuration.ClassName = "MsSql.SqlDatabaseScript"; - - _variables.DatabaseName = "dbName"; - _variables.CurrentVersion = "1.0"; - _variables.TargetVersion = "2.0"; + _sut.ClassName = "MsSql.SqlDatabaseScript"; + + _variables + .Setup(v => v.GetValue("DatabaseName")) + .Returns("dbName"); + _variables + .Setup(v => v.GetValue("CurrentVersion")) + .Returns("1.0"); + _variables + .Setup(v => v.GetValue("TargetVersion")) + .Returns("2.0"); _sut.DisplayName = "2.1_2.2.dll"; _sut.ReadAssemblyContent = () => File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "2.1_2.2.dll")); -#if !NET452 +#if !NET472 using (new ConsoleListener(_log.Object)) #endif { - _sut.Execute(new DbCommandStub(_command.Object), _variables, _log.Object); + _sut.Execute(new DbCommandStub(_command.Object), _variables.Object, _log.Object); } _logOutput.ShouldContain("start execution"); @@ -78,20 +81,26 @@ public void ExecuteExampleMsSql() [Test] public void ExecuteExamplePgSql() { - _sut.Configuration.ClassName = "PgSql.SqlDatabaseScript"; - - _variables.DatabaseName = "dbName"; - _variables.CurrentVersion = "1.0"; - _variables.TargetVersion = "2.0"; + _sut.ClassName = "PgSql.SqlDatabaseScript"; + + _variables + .Setup(v => v.GetValue("DatabaseName")) + .Returns("dbName"); + _variables + .Setup(v => v.GetValue("CurrentVersion")) + .Returns("1.0"); + _variables + .Setup(v => v.GetValue("TargetVersion")) + .Returns("2.0"); _sut.DisplayName = "2.1_2.2.dll"; _sut.ReadAssemblyContent = () => File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "2.1_2.2.dll")); -#if !NET452 +#if !NET472 using (new ConsoleListener(_log.Object)) #endif { - _sut.Execute(new DbCommandStub(_command.Object), _variables, _log.Object); + _sut.Execute(new DbCommandStub(_command.Object), _variables.Object, _log.Object); } _logOutput.ShouldContain("start execution"); @@ -110,7 +119,7 @@ public void FailToResolveExecutor() { var domain = new Mock(MockBehavior.Strict); domain - .Setup(d => d.ResolveScriptExecutor(_sut.Configuration.ClassName, _sut.Configuration.MethodName)) + .Setup(d => d.ResolveScriptExecutor(_sut.ClassName, _sut.MethodName)) .Returns(false); Assert.Throws(() => _sut.ResolveScriptExecutor(domain.Object)); @@ -121,10 +130,10 @@ public void FailOnExecute() { var domain = new Mock(MockBehavior.Strict); domain - .Setup(d => d.Execute(_command.Object, _variables)) + .Setup(d => d.Execute(_command.Object, _variables.Object)) .Returns(false); - Assert.Throws(() => _sut.Execute(domain.Object, _command.Object, _variables)); + Assert.Throws(() => _sut.Execute(domain.Object, _command.Object, _variables.Object)); } [Test] @@ -132,25 +141,18 @@ public void ExecuteWhatIf() { var domain = new Mock(MockBehavior.Strict); - _sut.Execute(domain.Object, null, _variables); + _sut.Execute(domain.Object, null, _variables.Object); } [Test] public void GetDependencies() { - var description = Encoding.Default.GetBytes(@" --- module dependency: a 1.0 --- module dependency: b 1.0"); - - _sut.ReadDescriptionContent = () => new MemoryStream(description); + _sut.ReadDescriptionContent = () => new MemoryStream(Encoding.Default.GetBytes("content")); var actual = _sut.GetDependencies(); - actual.ShouldBe(new[] - { - new ScriptDependency("a", new Version("1.0")), - new ScriptDependency("b", new Version("1.0")) - }); + actual.ShouldNotBeNull(); + actual.ReadToEnd().ShouldBe("content"); } [Test] @@ -160,6 +162,6 @@ public void GetDependenciesNoDescription() var actual = _sut.GetDependencies(); - actual.ShouldBeEmpty(); + actual.ShouldBeNull(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/DbCommandStub.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/DbCommandStub.cs similarity index 89% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/DbCommandStub.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/DbCommandStub.cs index aa28051f..bf46fbc9 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/DbCommandStub.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/DbCommandStub.cs @@ -2,7 +2,9 @@ using System.Data; using System.Data.Common; -namespace SqlDatabase.Scripts.AssemblyInternal; +#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes). + +namespace SqlDatabase.Adapter.AssemblyScripts; internal sealed class DbCommandStub : DbCommand { @@ -72,7 +74,7 @@ public override int ExecuteNonQuery() return _command.ExecuteNonQuery(); } - public override object ExecuteScalar() + public override object? ExecuteScalar() { return _command.ExecuteScalar(); } diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/DefaultEntryPointTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/DefaultEntryPointTest.cs similarity index 79% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/DefaultEntryPointTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/DefaultEntryPointTest.cs index 45177d1d..2b9e41b4 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/DefaultEntryPointTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/DefaultEntryPointTest.cs @@ -3,22 +3,23 @@ using System.Data; using Moq; using NUnit.Framework; +using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public class DefaultEntryPointTest { - private DefaultEntryPoint _sut; - private IList _logOutput; - private Mock _command; - private Mock> _variables; + private DefaultEntryPoint _sut = null!; + private IList _logOutput = null!; + private Mock _command = null!; + private Mock> _variables = null!; [SetUp] public void BeforeEachTest() { _command = new Mock(MockBehavior.Strict); - _variables = new Mock>(MockBehavior.Strict); + _variables = new Mock>(MockBehavior.Strict); _logOutput = new List(); @@ -27,18 +28,18 @@ public void BeforeEachTest() .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); log .Setup(l => l.Error(It.IsAny())) .Callback(m => { - Console.WriteLine("Error: {0}", m); + TestOutput.WriteLine("Error: {0}", m); _logOutput.Add(m); }); - _sut = new DefaultEntryPoint { Log = log.Object }; + _sut = new DefaultEntryPoint(log.Object, null!, null!); } [Test] diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/EntryPointResolverTest.Stubs.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/EntryPointResolverTest.Stubs.cs similarity index 95% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/EntryPointResolverTest.Stubs.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/EntryPointResolverTest.Stubs.cs index eb67a118..399a8a9d 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/EntryPointResolverTest.Stubs.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/EntryPointResolverTest.Stubs.cs @@ -3,7 +3,7 @@ using System.Data; using System.Data.SqlClient; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; public partial class EntryPointResolverTest { diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/EntryPointResolverTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/EntryPointResolverTest.cs similarity index 54% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/EntryPointResolverTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/EntryPointResolverTest.cs index e5764739..50f5c53b 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/EntryPointResolverTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/EntryPointResolverTest.cs @@ -1,16 +1,16 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public partial class EntryPointResolverTest { - private EntryPointResolver _sut; - private IList _logErrorOutput; + private EntryPointResolver _sut = null!; + private IList _logErrorOutput = null!; [SetUp] public void BeforeEachTest() @@ -22,35 +22,35 @@ public void BeforeEachTest() .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); }); log .Setup(l => l.Error(It.IsAny())) .Callback(m => { - Console.WriteLine("Error: {0}", m); + TestOutput.WriteLine("Error: {0}", m); _logErrorOutput.Add(m); }); - _sut = new EntryPointResolver { Log = log.Object }; + _sut = new EntryPointResolver(log.Object, null!, null!); } [Test] [TestCase(nameof(ExampleSqlDatabaseScript))] [TestCase(nameof(EntryPointResolverTest) + "+" + nameof(ExampleSqlDatabaseScript))] - [TestCase("AssemblyInternal." + nameof(EntryPointResolverTest) + "+" + nameof(ExampleSqlDatabaseScript))] - [TestCase("Scripts.AssemblyInternal." + nameof(EntryPointResolverTest) + "+" + nameof(ExampleSqlDatabaseScript))] - [TestCase("SqlDatabase.Scripts.AssemblyInternal." + nameof(EntryPointResolverTest) + "+" + nameof(ExampleSqlDatabaseScript))] + [TestCase("AssemblyScripts." + nameof(EntryPointResolverTest) + "+" + nameof(ExampleSqlDatabaseScript))] + [TestCase("Adapter.AssemblyScripts." + nameof(EntryPointResolverTest) + "+" + nameof(ExampleSqlDatabaseScript))] + [TestCase("SqlDatabase.Adapter.AssemblyScripts." + nameof(EntryPointResolverTest) + "+" + nameof(ExampleSqlDatabaseScript))] public void ResolveFromExample(string className) { _sut.ExecutorClassName = className; _sut.ExecutorMethodName = nameof(ExampleSqlDatabaseScript.Execute); var actual = _sut.Resolve(GetType().Assembly); - CollectionAssert.IsEmpty(_logErrorOutput); - Assert.IsInstanceOf(actual); + _logErrorOutput.ShouldBeEmpty(); + actual.ShouldBeAssignableTo(); - var entryPoint = (DefaultEntryPoint)actual; + var entryPoint = (DefaultEntryPoint)actual!; entryPoint.Log.ShouldNotBeNull(); entryPoint.ScriptInstance.ShouldBeOfType(); entryPoint.Method.Method.Name.ShouldBe(nameof(ExampleSqlDatabaseScript.Execute)); @@ -62,8 +62,8 @@ public void FailToCreateInstance() _sut.ExecutorClassName = nameof(DatabaseScriptWithInvalidConstructor); _sut.ExecutorMethodName = nameof(DatabaseScriptWithInvalidConstructor.Execute); - Assert.IsNull(_sut.Resolve(GetType().Assembly)); - CollectionAssert.IsNotEmpty(_logErrorOutput); + _sut.Resolve(GetType().Assembly).ShouldBeNull(); + _logErrorOutput.ShouldNotBeEmpty(); } [Test] @@ -73,13 +73,12 @@ public void ResolveExecuteWithCommandOnly() _sut.ExecutorMethodName = nameof(DatabaseScriptWithOneParameter.ExecuteCommand); var actual = _sut.Resolve(GetType().Assembly); - CollectionAssert.IsEmpty(_logErrorOutput); - Assert.IsInstanceOf(actual); + _logErrorOutput.ShouldBeEmpty(); - var entryPoint = (DefaultEntryPoint)actual; - Assert.IsNotNull(entryPoint.Log); - Assert.IsInstanceOf(entryPoint.ScriptInstance); - Assert.IsNotNull(entryPoint.Method); + var entryPoint = actual.ShouldBeOfType(); + entryPoint.Log.ShouldNotBeNull(); + entryPoint.ScriptInstance.ShouldBeOfType(); + entryPoint.Method.ShouldNotBeNull(); } [Test] @@ -89,12 +88,11 @@ public void ResolveExecuteWithConnection() _sut.ExecutorMethodName = nameof(DatabaseScriptWithConnection.Run); var actual = _sut.Resolve(GetType().Assembly); - CollectionAssert.IsEmpty(_logErrorOutput); - Assert.IsInstanceOf(actual); + _logErrorOutput.ShouldBeEmpty(); - var entryPoint = (DefaultEntryPoint)actual; - Assert.IsNotNull(entryPoint.Log); - Assert.IsInstanceOf(entryPoint.ScriptInstance); - Assert.IsNotNull(entryPoint.Method); + var entryPoint = actual.ShouldBeOfType(); + entryPoint.Log.ShouldNotBeNull(); + entryPoint.ScriptInstance.ShouldBeOfType(); + entryPoint.Method.ShouldNotBeNull(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverCommandDictionaryTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverCommandDictionaryTest.cs similarity index 75% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverCommandDictionaryTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverCommandDictionaryTest.cs index e772b882..a8d70899 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverCommandDictionaryTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverCommandDictionaryTest.cs @@ -4,14 +4,14 @@ using Moq; using NUnit.Framework; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public class ExecuteMethodResolverCommandDictionaryTest { - private ExecuteMethodResolverCommandDictionary _sut; - private IDbCommand _executeCommand; - private IReadOnlyDictionary _executeVariables; + private ExecuteMethodResolverCommandDictionary _sut = null!; + private IDbCommand? _executeCommand; + private IReadOnlyDictionary? _executeVariables; [SetUp] public void BeforeEachTest() @@ -23,18 +23,18 @@ public void BeforeEachTest() public void IsMatch() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - Assert.IsTrue(_sut.IsMatch(method)); + Assert.IsTrue(_sut.IsMatch(method!)); } [Test] public void CreateDelegate() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - var actual = _sut.CreateDelegate(this, method); + var actual = _sut.CreateDelegate(this, method!); Assert.IsNotNull(actual); var command = new Mock(MockBehavior.Strict); - var variables = new Mock>(MockBehavior.Strict); + var variables = new Mock>(MockBehavior.Strict); actual(command.Object, variables.Object); @@ -42,7 +42,7 @@ public void CreateDelegate() Assert.AreEqual(_executeVariables, variables.Object); } - private void Execute(IDbCommand command, IReadOnlyDictionary variables) + private void Execute(IDbCommand command, IReadOnlyDictionary variables) { Assert.IsNull(_executeCommand); _executeCommand = command; diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverCommandTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverCommandTest.cs similarity index 75% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverCommandTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverCommandTest.cs index 596c9f4e..81335baf 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverCommandTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverCommandTest.cs @@ -3,13 +3,13 @@ using Moq; using NUnit.Framework; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public class ExecuteMethodResolverCommandTest { - private ExecuteMethodResolverCommand _sut; - private IDbCommand _executeCommand; + private ExecuteMethodResolverCommand _sut = null!; + private IDbCommand? _executeCommand; [SetUp] public void BeforeEachTest() @@ -21,18 +21,18 @@ public void BeforeEachTest() public void IsMatch() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - Assert.IsTrue(_sut.IsMatch(method)); + Assert.IsTrue(_sut.IsMatch(method!)); } [Test] public void CreateDelegate() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - var actual = _sut.CreateDelegate(this, method); + var actual = _sut.CreateDelegate(this, method!); Assert.IsNotNull(actual); var command = new Mock(MockBehavior.Strict); - actual(command.Object, null); + actual(command.Object, null!); Assert.AreEqual(_executeCommand, command.Object); } diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverDbConnectionTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverDbConnectionTest.cs similarity index 77% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverDbConnectionTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverDbConnectionTest.cs index bce6318b..ace9f95d 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverDbConnectionTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverDbConnectionTest.cs @@ -1,16 +1,15 @@ using System.Data; -using System.Data.SqlClient; using System.Reflection; using Moq; using NUnit.Framework; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public class ExecuteMethodResolverDbConnectionTest { - private ExecuteMethodResolverDbConnection _sut; - private IDbConnection _executeConnection; + private ExecuteMethodResolverDbConnection _sut = null!; + private IDbConnection? _executeConnection; [SetUp] public void BeforeEachTest() @@ -22,14 +21,14 @@ public void BeforeEachTest() public void IsMatch() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - Assert.IsTrue(_sut.IsMatch(method)); + Assert.IsTrue(_sut.IsMatch(method!)); } [Test] public void CreateDelegate() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - var actual = _sut.CreateDelegate(this, method); + var actual = _sut.CreateDelegate(this, method!); Assert.IsNotNull(actual); var connection = new Mock(MockBehavior.Strict); @@ -39,7 +38,7 @@ public void CreateDelegate() .SetupGet(c => c.Connection) .Returns(connection.Object); - actual(command.Object, null); + actual(command.Object, null!); Assert.AreEqual(_executeConnection, connection.Object); } diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverDictionaryCommandTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverDictionaryCommandTest.cs similarity index 70% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverDictionaryCommandTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverDictionaryCommandTest.cs index c5a19fe7..87ea00f0 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverDictionaryCommandTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverDictionaryCommandTest.cs @@ -4,14 +4,14 @@ using Moq; using NUnit.Framework; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public class ExecuteMethodResolverDictionaryCommandTest { - private ExecuteMethodResolverDictionaryCommand _sut; - private IDbCommand _executeCommand; - private IReadOnlyDictionary _executeVariables; + private ExecuteMethodResolverDictionaryCommand _sut = null!; + private IDbCommand? _executeCommand; + private IReadOnlyDictionary? _executeVariables; [SetUp] public void BeforeEachTest() @@ -23,18 +23,18 @@ public void BeforeEachTest() public void IsMatch() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - Assert.IsTrue(_sut.IsMatch(method)); + Assert.IsTrue(_sut.IsMatch(method!)); } [Test] public void CreateDelegate() { var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - var actual = _sut.CreateDelegate(this, method); + var actual = _sut.CreateDelegate(this, method!); Assert.IsNotNull(actual); var command = new Mock(MockBehavior.Strict); - var variables = new Mock>(MockBehavior.Strict); + var variables = new Mock>(MockBehavior.Strict); actual(command.Object, variables.Object); @@ -42,7 +42,7 @@ public void CreateDelegate() Assert.AreEqual(_executeVariables, variables.Object); } - private void Execute(IReadOnlyDictionary variables, IDbCommand command) + private void Execute(IReadOnlyDictionary variables, IDbCommand command) { Assert.IsNull(_executeCommand); _executeCommand = command; diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverSqlConnectionTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverSqlConnectionTest.cs similarity index 52% rename from Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverSqlConnectionTest.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverSqlConnectionTest.cs index ffb4d9f4..b7995697 100644 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/ExecuteMethodResolverSqlConnectionTest.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/ExecuteMethodResolverSqlConnectionTest.cs @@ -3,34 +3,38 @@ using System.Reflection; using Moq; using NUnit.Framework; +using Shouldly; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; [TestFixture] public class ExecuteMethodResolverSqlConnectionTest { - private ExecuteMethodResolverSqlConnection _sut; - private SqlConnection _executeConnection; + private ExecuteMethodResolverSqlConnection _sut = null!; + private SqlConnection? _executeConnection; + private MethodInfo _execute = null!; [SetUp] public void BeforeEachTest() { + _execute = GetType() + .GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic) + .ShouldNotBeNull(); + _sut = new ExecuteMethodResolverSqlConnection(); } [Test] public void IsMatch() { - var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - Assert.IsTrue(_sut.IsMatch(method)); + _sut.IsMatch(_execute).ShouldBeTrue(); } [Test] public void CreateDelegate() { - var method = GetType().GetMethod(nameof(Execute), BindingFlags.Instance | BindingFlags.NonPublic); - var actual = _sut.CreateDelegate(this, method); - Assert.IsNotNull(actual); + var actual = _sut.CreateDelegate(this, _execute); + actual.ShouldNotBeNull(); var connection = new SqlConnection(); @@ -39,13 +43,13 @@ public void CreateDelegate() .SetupGet(c => c.Connection) .Returns(connection); - actual(command.Object, null); - Assert.AreEqual(_executeConnection, connection); + actual(command.Object, null!); + _executeConnection.ShouldBe(connection); } private void Execute(SqlConnection connection) { - Assert.IsNull(_executeConnection); + _executeConnection.ShouldBeNull(); _executeConnection = connection; } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/Net472/Net472SubDomainTest.StepWithSubDomain.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/Net472/Net472SubDomainTest.StepWithSubDomain.cs new file mode 100644 index 00000000..c7d0a033 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/Net472/Net472SubDomainTest.StepWithSubDomain.cs @@ -0,0 +1,65 @@ +#if NET472 +using System; +using System.Data; +using System.IO; + +namespace SqlDatabase.Adapter.AssemblyScripts.Net472; + +public partial class Net472SubDomainTest +{ + public sealed class StepWithSubDomain + { + public void ShowAppBase(IDbCommand command) + { + var assembly = GetType().Assembly; + + command.CommandText = assembly.Location; + command.ExecuteNonQuery(); + + command.CommandText = AppDomain.CurrentDomain.BaseDirectory; + command.ExecuteNonQuery(); + } + + public void ShowConfiguration(IDbCommand command) + { + command.CommandText = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; + command.ExecuteNonQuery(); + + command.CommandText = "do something"; + command.ExecuteNonQuery(); + } + + public void Execute(IDbCommand command) + { + var assembly = GetType().Assembly; + + var setup = new AppDomainSetup + { + ApplicationBase = Path.GetDirectoryName(assembly.Location), + ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile + }; + + var domain = AppDomain.CreateDomain("StepWithSubDomain", null, setup); + try + { + var agent = (StepDomainAgent)domain.CreateInstanceFromAndUnwrap(assembly.Location, typeof(StepDomainAgent).FullName); + + command.CommandText = agent.Hello(); + command.ExecuteNonQuery(); + } + finally + { + AppDomain.Unload(domain); + } + } + } + + public sealed class StepDomainAgent : MarshalByRefObject + { + public string Hello() + { + return "hello"; + } + } +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/Net472/Net472SubDomainTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/Net472/Net472SubDomainTest.cs new file mode 100644 index 00000000..93f7e122 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/Net472/Net472SubDomainTest.cs @@ -0,0 +1,105 @@ +#if NET472 +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using Moq; +using NUnit.Framework; +using Shouldly; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Adapter.AssemblyScripts.Net472; + +[TestFixture] +public partial class Net472SubDomainTest +{ + private Net472SubDomain _sut = null!; + private Mock _variables = null!; + private Mock _command = null!; + + private IList _executedScripts = null!; + + [SetUp] + public void BeforeEachTest() + { + _variables = new Mock(MockBehavior.Strict); + + var log = new Mock(MockBehavior.Strict); + log + .Setup(l => l.Info(It.IsAny())) + .Callback(m => TestOutput.WriteLine("Info: {0}", m)); + log + .Setup(l => l.Error(It.IsAny())) + .Callback(m => TestOutput.WriteLine("Error: {0}", m)); + + _executedScripts = new List(); + _command = new Mock(MockBehavior.Strict); + _command.SetupProperty(c => c.CommandText); + _command + .Setup(c => c.ExecuteNonQuery()) + .Callback(() => _executedScripts.Add(_command.Object.CommandText)) + .Returns(0); + + _sut = SubDomainFactory.Create( + log.Object, + GetType().Assembly.Location, + () => File.ReadAllBytes(GetType().Assembly.Location)) + .ShouldBeOfType(); + + _sut.Initialize(); + } + + [TearDown] + public void AfterEachTest() + { + _sut?.Unload(); + _sut?.Dispose(); + } + + [Test] + public void ValidateScriptDomainAppBase() + { + _sut.ResolveScriptExecutor(nameof(StepWithSubDomain), nameof(StepWithSubDomain.ShowAppBase)).ShouldBeTrue(); + _sut.Execute(new DbCommandStub(_command.Object), _variables.Object); + _sut.Unload(); + _sut.Dispose(); + + _executedScripts.Count.ShouldBe(2); + + var assemblyFileName = _executedScripts[0]; + FileAssert.DoesNotExist(assemblyFileName); + Path.GetFileName(GetType().Assembly.Location).ShouldBe(Path.GetFileName(assemblyFileName)); + + var appBase = _executedScripts[1]; + DirectoryAssert.DoesNotExist(appBase); + Path.GetDirectoryName(assemblyFileName).ShouldBe(appBase); + } + + [Test] + public void ValidateScriptDomainConfiguration() + { + _sut.ResolveScriptExecutor(nameof(StepWithSubDomain), nameof(StepWithSubDomain.ShowConfiguration)).ShouldBeTrue(); + _sut.Execute(new DbCommandStub(_command.Object), _variables.Object); + _sut.Unload(); + _sut.Dispose(); + + _executedScripts.Count.ShouldBe(2); + + var configurationFile = _executedScripts[0]; + configurationFile.ShouldBe(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); + + var connectionString = _executedScripts[1]; + connectionString.ShouldBe("do something"); + } + + [Test] + public void ValidateScriptDomainCreateSubDomain() + { + _sut.ResolveScriptExecutor(nameof(StepWithSubDomain), nameof(StepWithSubDomain.Execute)).ShouldBeTrue(); + _sut.Execute(new DbCommandStub(_command.Object), _variables.Object); + + _executedScripts.Count.ShouldBe(1); + _executedScripts[0].ShouldBe("hello"); + } +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/NetCore/NetCoreSubDomainTest.StepWithSubDomain.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/NetCore/NetCoreSubDomainTest.StepWithSubDomain.cs new file mode 100644 index 00000000..6d3c7d8c --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/NetCore/NetCoreSubDomainTest.StepWithSubDomain.cs @@ -0,0 +1,21 @@ +using System; +using System.Data; + +namespace SqlDatabase.Adapter.AssemblyScripts.NetCore; + +public partial class NetCoreSubDomainTest +{ + public sealed class StepWithCoreSubDomain + { + public void ShowAppBase(IDbCommand command) + { + var assembly = GetType().Assembly; + + command.CommandText = assembly.Location; + command.ExecuteNonQuery(); + + command.CommandText = AppDomain.CurrentDomain.BaseDirectory; + command.ExecuteNonQuery(); + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/NetCore/NetCoreSubDomainTest.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/NetCore/NetCoreSubDomainTest.cs new file mode 100644 index 00000000..52550ee0 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/NetCore/NetCoreSubDomainTest.cs @@ -0,0 +1,76 @@ +#if !NET472 +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using Moq; +using NUnit.Framework; +using Shouldly; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Adapter.AssemblyScripts.NetCore; + +[TestFixture] +public partial class NetCoreSubDomainTest +{ + private NetCoreSubDomain _sut = null!; + private Mock _variables = null!; + private Mock _command = null!; + + private IList _executedScripts = null!; + + [SetUp] + public void BeforeEachTest() + { + _variables = new Mock(MockBehavior.Strict); + + var log = new Mock(MockBehavior.Strict); + log + .Setup(l => l.Info(It.IsAny())) + .Callback(m => TestOutput.WriteLine("Info: {0}", m)); + log + .Setup(l => l.Error(It.IsAny())) + .Callback(m => TestOutput.WriteLine("Error: {0}", m)); + + _executedScripts = new List(); + _command = new Mock(MockBehavior.Strict); + _command.SetupProperty(c => c.CommandText); + _command + .Setup(c => c.ExecuteNonQuery()) + .Callback(() => _executedScripts.Add(_command.Object.CommandText)) + .Returns(0); + + _sut = SubDomainFactory.Create( + log.Object, + GetType().Assembly.Location, + () => File.ReadAllBytes(GetType().Assembly.Location)) + .ShouldBeOfType(); + + _sut.Initialize(); + } + + [TearDown] + public void AfterEachTest() + { + _sut?.Unload(); + _sut?.Dispose(); + } + + [Test] + public void ValidateScriptDomainAppBase() + { + _sut.ResolveScriptExecutor(nameof(StepWithCoreSubDomain), nameof(StepWithCoreSubDomain.ShowAppBase)).ShouldBeTrue(); + _sut.Execute(new DbCommandStub(_command.Object), _variables.Object); + _sut.Unload(); + _sut.Dispose(); + + _executedScripts.Count.ShouldBe(2); + + var assemblyFileName = _executedScripts[0]; + assemblyFileName.ShouldBeEmpty(); + + var appBase = _executedScripts[1]; + appBase.ShouldBe(AppDomain.CurrentDomain.BaseDirectory); + } +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/SqlDatabase.Adapter.AssemblyScripts.Test.csproj b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/SqlDatabase.Adapter.AssemblyScripts.Test.csproj new file mode 100644 index 00000000..a2ca550f --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/SqlDatabase.Adapter.AssemblyScripts.Test.csproj @@ -0,0 +1,25 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Adapter.AssemblyScripts + NU1702 + + + + + + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/SqlDatabase.Adapter.AssemblyScripts.Test.csproj.user b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/SqlDatabase.Adapter.AssemblyScripts.Test.csproj.user new file mode 100644 index 00000000..5cb47e2f --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts.Test/SqlDatabase.Adapter.AssemblyScripts.Test.csproj.user @@ -0,0 +1,9 @@ + + + + + + Component + + + \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/AssemblyScript.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/AssemblyScript.cs new file mode 100644 index 00000000..ab3360f4 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/AssemblyScript.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; + +namespace SqlDatabase.Adapter.AssemblyScripts; + +internal sealed class AssemblyScript : IScript +{ + private const string DefaultClassName = "SqlDatabaseScript"; + private const string DefaultMethodName = "Execute"; + + public AssemblyScript( + string displayName, + string? className, + string? methodName, + Func readAssemblyContent, + Func readDescriptionContent) + { + DisplayName = displayName; + ClassName = string.IsNullOrWhiteSpace(className) ? DefaultClassName : className!; + MethodName = string.IsNullOrWhiteSpace(methodName) ? DefaultMethodName : methodName!; + ReadAssemblyContent = readAssemblyContent; + ReadDescriptionContent = readDescriptionContent; + } + + public string DisplayName { get; set; } + + public string ClassName { get; set; } + + public string MethodName { get; set; } + + public Func ReadAssemblyContent { get; internal set; } + + public Func ReadDescriptionContent { get; internal set; } + + public void Execute(IDbCommand? command, IVariables variables, ILogger logger) + { + var domain = SubDomainFactory.Create(logger, DisplayName, ReadAssemblyContent); + + using (domain) + { + try + { + domain.Initialize(); + ResolveScriptExecutor(domain); + Execute(domain, command, variables); + } + finally + { + domain.Unload(); + } + } + } + + public IEnumerable ExecuteReader(IDbCommand command, IVariables variables, ILogger logger) + { + throw new NotSupportedException("Assembly script does not support readers."); + } + + public TextReader? GetDependencies() + { + var description = ReadDescriptionContent(); + if (description == null) + { + return null; + } + + return new StreamReader(description); + } + + internal void ResolveScriptExecutor(ISubDomain domain) + { + if (!domain.ResolveScriptExecutor(ClassName, MethodName)) + { + throw new InvalidOperationException("Fail to resolve script executor."); + } + } + + internal void Execute(ISubDomain domain, IDbCommand? command, IVariables variables) + { + if (command != null && !domain.Execute(command, variables)) + { + throw new InvalidOperationException("Errors during script execution."); + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/AssemblyScriptFactory.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/AssemblyScriptFactory.cs new file mode 100644 index 00000000..2b67dd46 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/AssemblyScriptFactory.cs @@ -0,0 +1,71 @@ +using System; +using System.IO; +using System.Linq; +using SqlDatabase.FileSystem; + +namespace SqlDatabase.Adapter.AssemblyScripts; + +public sealed class AssemblyScriptFactory : IScriptFactory, IScriptEnvironment +{ + private readonly string? _configurationClassName; + private readonly string? _configurationMethodName; + + public AssemblyScriptFactory(string? configurationClassName, string? configurationMethodName) + { + _configurationClassName = configurationClassName; + _configurationMethodName = configurationMethodName; + } + + public bool IsSupported(IFile file) + { + return ".exe".Equals(file.Extension, StringComparison.OrdinalIgnoreCase) + || ".dll".Equals(file.Extension, StringComparison.OrdinalIgnoreCase); + } + + public IScript FromFile(IFile file) + { + return new AssemblyScript( + file.Name, + _configurationClassName, + _configurationMethodName, + CreateBinaryReader(file), + CreateScriptDescriptionReader(file)); + } + + public bool IsSupported(IScript script) => script is AssemblyScript; + + public void Initialize(ILogger logger) => SubDomainFactory.Test(); + + private static Func CreateBinaryReader(IFile file) + { + return () => BinaryRead(file); + } + + private static byte[] BinaryRead(IFile file) + { + using (var source = file.OpenRead()) + using (var dest = new MemoryStream()) + { + source.CopyTo(dest); + + return dest.ToArray(); + } + } + + private static Func CreateScriptDescriptionReader(IFile file) + { + return () => + { + var parent = file.GetParent(); + if (parent == null) + { + return null; + } + + var descriptionName = Path.GetFileNameWithoutExtension(file.Name) + ".txt"; + var description = parent.GetFiles().FirstOrDefault(i => string.Equals(descriptionName, i.Name, StringComparison.OrdinalIgnoreCase)); + + return description?.OpenRead(); + }; + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/CodeAnalysis/AllowNullAttribute.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/CodeAnalysis/AllowNullAttribute.cs new file mode 100644 index 00000000..39be8db8 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/CodeAnalysis/AllowNullAttribute.cs @@ -0,0 +1,8 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] +internal sealed class AllowNullAttribute : Attribute +{ +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/CodeAnalysis/NotNullWhenAttribute.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/CodeAnalysis/NotNullWhenAttribute.cs new file mode 100644 index 00000000..e3d56cf7 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/CodeAnalysis/NotNullWhenAttribute.cs @@ -0,0 +1,10 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +internal sealed class NotNullWhenAttribute : Attribute +{ + public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; + + public bool ReturnValue { get; } +} +#endif diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ConsoleListener.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ConsoleListener.cs similarity index 72% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/ConsoleListener.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/ConsoleListener.cs index fdc12512..1909d299 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ConsoleListener.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ConsoleListener.cs @@ -1,8 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Text; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; internal sealed class ConsoleListener : TextWriter { @@ -21,20 +22,21 @@ public ConsoleListener(ILogger logger) public override IFormatProvider FormatProvider => _original.FormatProvider; + [AllowNull] public override string NewLine { get => _original.NewLine; set => _original.NewLine = value; } - public override void Write(string value) + public override void Write(string? value) { - _logger.Info(value); + _logger.Info(value ?? string.Empty); } - public override void WriteLine(string value) + public override void WriteLine(string? value) { - _logger.Info(value); + _logger.Info(value ?? string.Empty); } protected override void Dispose(bool disposing) diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/DefaultEntryPoint.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/DefaultEntryPoint.cs similarity index 58% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/DefaultEntryPoint.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/DefaultEntryPoint.cs index adaa929e..5870beae 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/DefaultEntryPoint.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/DefaultEntryPoint.cs @@ -2,17 +2,24 @@ using System.Collections.Generic; using System.Data; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; internal sealed class DefaultEntryPoint : IEntryPoint { - public ILogger Log { get; set; } + public DefaultEntryPoint(ILogger log, object scriptInstance, Action> method) + { + Log = log; + ScriptInstance = scriptInstance; + Method = method; + } + + public ILogger Log { get; } - public object ScriptInstance { get; set; } + public object ScriptInstance { get; internal set; } - public Action> Method { get; set; } + public Action> Method { get; internal set; } - public bool Execute(IDbCommand command, IReadOnlyDictionary variables) + public bool Execute(IDbCommand command, IReadOnlyDictionary variables) { var result = false; diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/EntryPointResolver.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/EntryPointResolver.cs similarity index 65% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/EntryPointResolver.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/EntryPointResolver.cs index b5e754ac..d7d0208a 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/EntryPointResolver.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/EntryPointResolver.cs @@ -3,17 +3,24 @@ using System.Reflection; using System.Text; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; internal sealed class EntryPointResolver { - public ILogger Log { get; set; } + public EntryPointResolver(ILogger log, string executorClassName, string executorMethodName) + { + Log = log; + ExecutorClassName = executorClassName; + ExecutorMethodName = executorMethodName; + } + + public ILogger Log { get; } - public string ExecutorClassName { get; set; } + public string ExecutorClassName { get; internal set; } - public string ExecutorMethodName { get; set; } + public string ExecutorMethodName { get; internal set; } - public IEntryPoint Resolve(Assembly assembly) + public IEntryPoint? Resolve(Assembly assembly) { Log.Info("resolve script executor"); @@ -24,10 +31,6 @@ public IEntryPoint Resolve(Assembly assembly) } var method = ResolveMethod(type); - if (method == null) - { - return null; - } var message = new StringBuilder() .AppendFormat("found {0}.{1}(", type.FullName, method.Method.Name); @@ -51,23 +54,18 @@ public IEntryPoint Resolve(Assembly assembly) object scriptInstance; try { - scriptInstance = Activator.CreateInstance(type); + scriptInstance = Activator.CreateInstance(type)!; } catch (Exception ex) { - Log.Error("Fail to create instance of {0}.".FormatWith(type.FullName), ex); + Log.Error($"Fail to create instance of {type.FullName}.", ex); return null; } - return new DefaultEntryPoint - { - Log = Log, - ScriptInstance = scriptInstance, - Method = method.Resolver.CreateDelegate(scriptInstance, method.Method) - }; + return new DefaultEntryPoint(Log, scriptInstance, method.Resolver.CreateDelegate(scriptInstance, method.Method)); } - private Type ResolveClass(Assembly assembly) + private Type? ResolveClass(Assembly assembly) { var filter = assembly .GetExportedTypes() @@ -85,13 +83,13 @@ private Type ResolveClass(Assembly assembly) var candidates = filter.ToList(); if (candidates.Count == 0) { - Log.Error("public class {0} not found.".FormatWith(ExecutorClassName)); + Log.Error($"public class {ExecutorClassName} not found."); return null; } if (candidates.Count != 1) { - Log.Error("There are {0} items with signature public class {1}.".FormatWith(candidates.Count, ExecutorClassName)); + Log.Error($"There are {candidates.Count} items with signature public class {ExecutorClassName}."); return null; } @@ -120,35 +118,37 @@ private ExecuteMethodRef ResolveMethod(Type type) var resolver = methodResolvers[priority]; if (resolver.IsMatch(i)) { - return new ExecuteMethodRef - { - Method = i, - Resolver = resolver, - Priority = priority - }; + return new ExecuteMethodRef(priority, i, resolver); } } return null; }) .Where(i => i != null) - .OrderBy(i => i.Priority) + .OrderBy(i => i!.Priority) .ToList(); if (methods.Count == 0) { - Log.Error("public void {0}(IDbCommand command, IReadOnlyDictionary variables) not found in {1}.".FormatWith(ExecutorMethodName, type)); + Log.Error($"public void {ExecutorMethodName}(IDbCommand command, IReadOnlyDictionary variables) not found in {type}."); } - return methods[0]; + return methods[0]!; } private sealed class ExecuteMethodRef { - public int Priority { get; set; } + public ExecuteMethodRef(int priority, MethodInfo method, ExecuteMethodResolverBase resolver) + { + Priority = priority; + Method = method; + Resolver = resolver; + } + + public int Priority { get; } - public MethodInfo Method { get; set; } + public MethodInfo Method { get; } - public ExecuteMethodResolverBase Resolver { get; set; } + public ExecuteMethodResolverBase Resolver { get; } } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverBase.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverBase.cs similarity index 70% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverBase.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverBase.cs index bc060c01..9495dfc9 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverBase.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverBase.cs @@ -3,11 +3,11 @@ using System.Data; using System.Reflection; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; internal abstract class ExecuteMethodResolverBase { public abstract bool IsMatch(MethodInfo method); - public abstract Action> CreateDelegate(object instance, MethodInfo method); + public abstract Action> CreateDelegate(object instance, MethodInfo method); } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverCommand.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverCommand.cs similarity index 86% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverCommand.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverCommand.cs index 978582f4..8c80f335 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverCommand.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverCommand.cs @@ -3,7 +3,7 @@ using System.Data; using System.Reflection; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; // public void Execute(IDbCommand command) internal sealed class ExecuteMethodResolverCommand : ExecuteMethodResolverBase @@ -15,7 +15,7 @@ public override bool IsMatch(MethodInfo method) && typeof(IDbCommand) == parameters[0].ParameterType; } - public override Action> CreateDelegate(object instance, MethodInfo method) + public override Action> CreateDelegate(object instance, MethodInfo method) { var execute = (Action)Delegate.CreateDelegate( typeof(Action), diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverCommandDictionary.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverCommandDictionary.cs similarity index 84% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverCommandDictionary.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverCommandDictionary.cs index a442e25a..37881270 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverCommandDictionary.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverCommandDictionary.cs @@ -3,7 +3,7 @@ using System.Data; using System.Reflection; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; // public void Execute(IDbCommand command, IReadOnlyDictionary variables) internal sealed class ExecuteMethodResolverCommandDictionary : ExecuteMethodResolverBase @@ -16,10 +16,10 @@ public override bool IsMatch(MethodInfo method) && typeof(IReadOnlyDictionary) == parameters[1].ParameterType; } - public override Action> CreateDelegate(object instance, MethodInfo method) + public override Action> CreateDelegate(object instance, MethodInfo method) { - return (Action>)Delegate.CreateDelegate( - typeof(Action>), + return (Action>)Delegate.CreateDelegate( + typeof(Action>), instance, method); } diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverDbConnection.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverDbConnection.cs similarity index 79% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverDbConnection.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverDbConnection.cs index b742838e..e5d156ef 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverDbConnection.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverDbConnection.cs @@ -3,7 +3,7 @@ using System.Data; using System.Reflection; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; // public void Execute(IDbConnection connection) internal sealed class ExecuteMethodResolverDbConnection : ExecuteMethodResolverBase @@ -15,13 +15,13 @@ public override bool IsMatch(MethodInfo method) && typeof(IDbConnection) == parameters[0].ParameterType; } - public override Action> CreateDelegate(object instance, MethodInfo method) + public override Action> CreateDelegate(object instance, MethodInfo method) { var execute = (Action)Delegate.CreateDelegate( typeof(Action), instance, method); - return (command, variables) => execute(command.Connection); + return (command, _) => execute(command.Connection!); } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverDictionaryCommand.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverDictionaryCommand.cs similarity index 78% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverDictionaryCommand.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverDictionaryCommand.cs index 3ca4bd7d..891c7d5c 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverDictionaryCommand.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverDictionaryCommand.cs @@ -3,7 +3,7 @@ using System.Data; using System.Reflection; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; // public void Execute(IReadOnlyDictionary variables, IDbCommand command) internal sealed class ExecuteMethodResolverDictionaryCommand : ExecuteMethodResolverBase @@ -16,10 +16,10 @@ public override bool IsMatch(MethodInfo method) && typeof(IDbCommand) == parameters[1].ParameterType; } - public override Action> CreateDelegate(object instance, MethodInfo method) + public override Action> CreateDelegate(object instance, MethodInfo method) { - var execute = (Action, IDbCommand>)Delegate.CreateDelegate( - typeof(Action, IDbCommand>), + var execute = (Action, IDbCommand>)Delegate.CreateDelegate( + typeof(Action, IDbCommand>), instance, method); diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverSqlConnection.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverSqlConnection.cs new file mode 100644 index 00000000..a4ed5e68 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ExecuteMethodResolverSqlConnection.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq.Expressions; +using System.Reflection; + +namespace SqlDatabase.Adapter.AssemblyScripts; + +// public void Execute(SqlConnection connection) +internal sealed class ExecuteMethodResolverSqlConnection : ExecuteMethodResolverBase +{ + public override bool IsMatch(MethodInfo method) + { + var parameters = method.GetParameters(); + return parameters.Length == 1 + && "System.Data.SqlClient.SqlConnection".Equals(parameters[0].ParameterType.FullName, StringComparison.Ordinal); + } + + public override Action> CreateDelegate(object instance, MethodInfo method) + { + var command = Expression.Parameter(typeof(IDbCommand), "command"); + var variables = Expression.Parameter(typeof(IReadOnlyDictionary), "variables"); + + var connection = Expression.Property(command, nameof(IDbCommand.Connection)); + var sqlConnection = Expression.Convert(connection, method.GetParameters()[0].ParameterType); + var call = Expression.Call(Expression.Constant(instance), method, sqlConnection); + + return Expression.Lambda>>(call, command, variables).Compile(); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/IEntryPoint.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/IEntryPoint.cs similarity index 69% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/IEntryPoint.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/IEntryPoint.cs index 5377470b..3e2dcde7 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/IEntryPoint.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/IEntryPoint.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Data; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; internal interface IEntryPoint { - bool Execute(IDbCommand command, IReadOnlyDictionary variables); + bool Execute(IDbCommand command, IReadOnlyDictionary variables); } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ISubDomain.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/ISubDomain.cs similarity index 59% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/ISubDomain.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/ISubDomain.cs index bc7ed3a2..54bc68ae 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ISubDomain.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/ISubDomain.cs @@ -1,16 +1,10 @@ using System; using System.Data; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; internal interface ISubDomain : IDisposable { - ILogger Logger { get; set; } - - string AssemblyFileName { get; set; } - - Func ReadAssemblyContent { get; set; } - void Initialize(); void Unload(); diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/AppDomainAdapter.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/AppDomainAdapter.cs new file mode 100644 index 00000000..47aa6411 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/AppDomainAdapter.cs @@ -0,0 +1,163 @@ +using System; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.InteropServices; + +namespace SqlDatabase.Adapter.AssemblyScripts.Net472; + +internal static class AppDomainAdapter +{ + private static Func? _createDomain; + private static Func? _createInstanceFromAndUnwrap; + + public static void Initialize() + { + try + { + GetOrBuildCreateDomain(); + GetOrBuildCreateInstanceFromAndUnwrap(); + } + catch (Exception ex) + { + throw new InvalidOperationException($"AppDomain host initialization failed, framework {RuntimeInformation.FrameworkDescription}", ex); + } + } + + public static AppDomain CreateDomain(string domainFriendlyName, string applicationBase) + { + var createDomain = GetOrBuildCreateDomain(); + return createDomain(domainFriendlyName, applicationBase); + } + + public static DomainAgent CreateInstanceFromAndUnwrap(AppDomain domain) + { + var createInstanceFromAndUnwrap = GetOrBuildCreateInstanceFromAndUnwrap(); + return createInstanceFromAndUnwrap(domain); + } + + private static Func GetOrBuildCreateDomain() + { + if (_createDomain == null) + { + _createDomain = BuildCreateDomain(); + } + + return _createDomain; + } + + private static Func GetOrBuildCreateInstanceFromAndUnwrap() + { + if (_createInstanceFromAndUnwrap == null) + { + _createInstanceFromAndUnwrap = BuildCreateInstanceFromAndUnwrap(); + } + + return _createInstanceFromAndUnwrap; + } + + private static Func BuildCreateInstanceFromAndUnwrap() + { + // CreateInstanceFromAndUnwrap(GetType().Assembly.Location, typeof(DomainAgent).FullName) + var domain = Expression.Parameter(typeof(AppDomain), "domain"); + + var proxy = Expression.Call( + domain, + ResolveAppDomainCreateInstanceFromAndUnwrap(), + Expression.Constant(typeof(AppDomainAdapter).Assembly.Location), + Expression.Constant(typeof(DomainAgent).FullName)); + + var body = Expression.Convert(proxy, typeof(DomainAgent)); + + var result = Expression.Lambda>(body, domain); + return result.Compile(); + } + + private static Func BuildCreateDomain() + { + var applicationBase = Expression.Parameter(typeof(string), "applicationBase"); + var domainFriendlyName = Expression.Parameter(typeof(string), "domainFriendlyName"); + + ////var setup = new AppDomainSetup + ////{ + //// ApplicationBase = _appBase.Location, + //// ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, + //// LoaderOptimization = LoaderOptimization.MultiDomainHost + ////}; + ////AppDomain.CreateDomain(appBaseName, null, setup) + var createDomain = ResolveAppDomainCreateDomain(); + var createDomainParameters = createDomain.GetParameters(); + + var configurationFile = Expression.Property(Expression.Constant(AppDomain.CurrentDomain), "SetupInformation"); + + var setup = Expression.Variable(createDomainParameters[2].ParameterType, "setup"); + var body = Expression.Block( + typeof(AppDomain), + new ParameterExpression[] { setup }, + Expression.Assign(setup, Expression.New(createDomainParameters[2].ParameterType)), + Expression.Assign( + Expression.Property(setup, "ApplicationBase"), + applicationBase), + Expression.Assign( + Expression.Property(setup, "ConfigurationFile"), + Expression.Property(configurationFile, "ConfigurationFile")), + Expression.Assign( + Expression.Property(setup, "LoaderOptimization"), + Expression.Constant(LoaderOptimization.MultiDomainHost)), + Expression.Call( + createDomain, + domainFriendlyName, + Expression.Constant(null, createDomainParameters[1].ParameterType), + setup)); + + var result = Expression.Lambda>(body, domainFriendlyName, applicationBase); + return result.Compile(); + } + + private static MethodInfo ResolveAppDomainCreateInstanceFromAndUnwrap() + { + // CreateInstanceFromAndUnwrap(string assemblyName, string typeName) + var result = typeof(AppDomain) + .GetMethods(BindingFlags.Public | BindingFlags.Instance) + .Where(i => "CreateInstanceFromAndUnwrap".Equals(i.Name, StringComparison.Ordinal)) + .Where(i => + { + var parameters = i.GetParameters(); + return parameters.Length == 2 + && parameters[0].ParameterType == typeof(string) + && parameters[1].ParameterType == typeof(string); + }) + .FirstOrDefault(); + + if (result == null) + { + throw new NotSupportedException("The method AppDomain.CreateInstanceFromAndUnwrap not found."); + } + + return result; + } + + private static MethodInfo ResolveAppDomainCreateDomain() + { + // CreateDomain(string friendlyName, System.Security.Policy.Evidence securityInfo, AppDomainSetup info) + var result = typeof(AppDomain) + .GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(i => nameof(AppDomain.CreateDomain).Equals(i.Name, StringComparison.Ordinal)) + .Where(i => + { + var parameters = i.GetParameters(); + return parameters.Length == 3 + && parameters[0].ParameterType == typeof(string) + && parameters[1].ParameterType.FullName!.Equals("System.Security.Policy.Evidence", StringComparison.Ordinal) + && parameters[2].ParameterType.FullName!.Equals("System.AppDomainSetup"); + }) + .FirstOrDefault(); + + if (result == null) + { + throw new NotSupportedException("The method AppDomain.CreateDomain not found."); + } + + return result; + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/DomainAgent.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/DomainAgent.cs similarity index 62% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/DomainAgent.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/DomainAgent.cs index 102ab1ed..cc530ae1 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/DomainAgent.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/DomainAgent.cs @@ -5,17 +5,17 @@ using System.IO; using System.Reflection; -namespace SqlDatabase.Scripts.AssemblyInternal.Net452; +namespace SqlDatabase.Adapter.AssemblyScripts.Net472; internal sealed class DomainAgent : MarshalByRefObject { - private ConsoleListener _consoleRedirect; + private ConsoleListener? _consoleRedirect; - internal Assembly Assembly { get; set; } + internal Assembly? Assembly { get; set; } - internal IEntryPoint EntryPoint { get; set; } + internal IEntryPoint? EntryPoint { get; set; } - internal ILogger Logger { get; set; } + internal ILogger? Logger { get; set; } public void LoadAssembly(string fileName) { @@ -37,21 +37,16 @@ public bool ResolveScriptExecutor(string className, string methodName) return true; } - var resolver = new EntryPointResolver - { - Log = Logger, - ExecutorClassName = className, - ExecutorMethodName = methodName - }; + var resolver = new EntryPointResolver(Logger!, className, methodName); - EntryPoint = resolver.Resolve(Assembly); + EntryPoint = resolver.Resolve(Assembly!); return EntryPoint != null; } - public bool Execute(IDbCommand command, IReadOnlyDictionary variables) + public bool Execute(IDbCommand command, IReadOnlyDictionary variables) { - return EntryPoint.Execute(command, variables); + return EntryPoint!.Execute(command, variables); } public void BeforeUnload() @@ -60,17 +55,17 @@ public void BeforeUnload() AppDomain.CurrentDomain.AssemblyResolve -= OnAssemblyResolve; } - private Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) + private Assembly? OnAssemblyResolve(object? sender, ResolveEventArgs args) { var argName = new AssemblyName(args.Name).Name; - var sqlDataBase = GetType().Assembly; - if (sqlDataBase.GetName().Name.Equals(argName, StringComparison.OrdinalIgnoreCase)) + var sqlDataBase = GetType().Assembly!; + if (sqlDataBase.GetName().Name!.Equals(argName, StringComparison.OrdinalIgnoreCase)) { return sqlDataBase; } - var fileName = Path.Combine(Path.GetDirectoryName(sqlDataBase.Location), argName + ".dll"); + var fileName = Path.Combine(Path.GetDirectoryName(sqlDataBase.Location)!, argName + ".dll"); if (File.Exists(fileName)) { return Assembly.LoadFrom(fileName); diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/DomainDirectory.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/DomainDirectory.cs similarity index 78% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/DomainDirectory.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/DomainDirectory.cs index a38e4952..fb6a52ad 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/DomainDirectory.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/DomainDirectory.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace SqlDatabase.Scripts.AssemblyInternal.Net452; +namespace SqlDatabase.Adapter.AssemblyScripts.Net472; internal sealed class DomainDirectory : IDisposable { @@ -26,7 +26,7 @@ public string SaveFile(byte[] content, string fileName) } catch (Exception ex) { - _logger.Error("Fail to copy content of [{0}]: {1}".FormatWith(fileName, ex.Message)); + _logger.Error($"Fail to copy content of [{fileName}]: {ex.Message}"); File.Delete(location); throw; } @@ -44,7 +44,7 @@ public void Dispose() } catch (Exception ex) { - _logger.Info("Fail to delete assembly content from {0}: {1}".FormatWith(Location, ex.Message)); + _logger.Info($"Fail to delete assembly content from {Location}: {ex.Message}"); } } } diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/LoggerProxy.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/LoggerProxy.cs similarity index 51% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/LoggerProxy.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/LoggerProxy.cs index e51b96bb..824ccf2e 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/LoggerProxy.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/LoggerProxy.cs @@ -1,12 +1,12 @@ using System; using System.Diagnostics; -namespace SqlDatabase.Scripts.AssemblyInternal.Net452; +namespace SqlDatabase.Adapter.AssemblyScripts.Net472; internal sealed class LoggerProxy : TraceListener, ILogger { - private readonly TraceListener _output; - private readonly ILogger _input; + private readonly TraceListener? _output; + private readonly ILogger? _input; public LoggerProxy(ILogger input) { @@ -18,29 +18,29 @@ public LoggerProxy(TraceListener output) _output = output; } - public override void Write(string message) + public override void Write(string? message) { throw new NotSupportedException(); } - public override void WriteLine(string message) + public override void WriteLine(string? message) { - _input.Info(message); + _input?.Info(message ?? string.Empty); } - public override void Fail(string message) + public override void Fail(string? message) { - _input.Error(message); + _input?.Error(message!); } void ILogger.Error(string message) { - _output.Fail(message); + _output?.Fail(message); } - void ILogger.Info(string message) + void ILogger.Info(string? message) { - _output.WriteLine(message); + _output?.WriteLine(message); } IDisposable ILogger.Indent() diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/Net472SubDomain.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/Net472SubDomain.cs new file mode 100644 index 00000000..81909fff --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/Net472/Net472SubDomain.cs @@ -0,0 +1,71 @@ +using System; +using System.Data; +using System.IO; + +namespace SqlDatabase.Adapter.AssemblyScripts.Net472; + +internal sealed class Net472SubDomain : ISubDomain +{ + private DomainDirectory? _appBase; + private AppDomain? _app; + private DomainAgent? _appAgent; + + public Net472SubDomain(ILogger logger, string assemblyFileName, Func readAssemblyContent) + { + Logger = logger; + AssemblyFileName = assemblyFileName; + ReadAssemblyContent = readAssemblyContent; + } + + public ILogger Logger { get; } + + public string AssemblyFileName { get; } + + public Func ReadAssemblyContent { get; } + + public static void Test() => AppDomainAdapter.Initialize(); + + public void Initialize() + { + Logger.Info($"create domain for {AssemblyFileName}"); + + var appBaseName = Path.GetFileName(AssemblyFileName); + _appBase = new DomainDirectory(Logger); + + var entryAssembly = _appBase.SaveFile(ReadAssemblyContent(), appBaseName); + + _app = AppDomainAdapter.CreateDomain(appBaseName, _appBase.Location); + _appAgent = AppDomainAdapter.CreateInstanceFromAndUnwrap(_app); + + _appAgent.RedirectConsoleOut(new LoggerProxy(Logger)); + _appAgent.LoadAssembly(entryAssembly); + } + + public void Unload() + { + _appAgent?.BeforeUnload(); + + if (_app != null) + { + AppDomain.Unload(_app); + } + + _app = null; + _appAgent = null; + } + + public bool ResolveScriptExecutor(string className, string methodName) + { + return _appAgent != null && _appAgent.ResolveScriptExecutor(className, methodName); + } + + public bool Execute(IDbCommand command, IVariables variables) + { + return _appAgent!.Execute(command, new VariablesProxy(variables)); + } + + public void Dispose() + { + _appBase?.Dispose(); + } +} diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/NetCore/AssemblyContext.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/NetCore/AssemblyContext.cs new file mode 100644 index 00000000..01d47ab0 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/NetCore/AssemblyContext.cs @@ -0,0 +1,33 @@ +#if !NET472 +using System; +using System.IO; +using System.Reflection; +using System.Runtime.Loader; + +namespace SqlDatabase.Adapter.AssemblyScripts.NetCore; + +internal sealed class AssemblyContext : AssemblyLoadContext +{ + public Assembly? ScriptAssembly { get; private set; } + + public void LoadScriptAssembly(byte[] assemblyContent) + { + using (var stream = new MemoryStream(assemblyContent)) + { + ScriptAssembly = LoadFromStream(stream); + } + } + + public void UnloadAll() + { + ScriptAssembly = null; + } + + protected override Assembly? Load(AssemblyName assemblyName) + { + var isScriptAssembly = assemblyName.Name != null + && assemblyName.Name.Equals(ScriptAssembly?.GetName().Name, StringComparison.OrdinalIgnoreCase); + return isScriptAssembly ? ScriptAssembly : null; + } +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/NetCore/NetCoreSubDomain.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/NetCore/NetCoreSubDomain.cs new file mode 100644 index 00000000..b1731894 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/NetCore/NetCoreSubDomain.cs @@ -0,0 +1,67 @@ +using System; +using System.Data; + +namespace SqlDatabase.Adapter.AssemblyScripts.NetCore; + +internal sealed class NetCoreSubDomain : ISubDomain +{ + private readonly AssemblyContext _assemblyContext; + ////private ConsoleListener _consoleRedirect; + + public NetCoreSubDomain(ILogger logger, string assemblyFileName, Func readAssemblyContent) + { + Logger = logger; + AssemblyFileName = assemblyFileName; + ReadAssemblyContent = readAssemblyContent; + _assemblyContext = new AssemblyContext(); + } + + public ILogger Logger { get; set; } + + public string AssemblyFileName { get; set; } + + public Func ReadAssemblyContent { get; set; } + + private IEntryPoint? EntryPoint { get; set; } + + public static void Test() + { + } + + public void Initialize() + { + _assemblyContext.LoadScriptAssembly(ReadAssemblyContent()); + + ////_consoleRedirect = new ConsoleListener(Logger); + } + + public void Unload() + { + ////_consoleRedirect?.Dispose(); + + _assemblyContext.UnloadAll(); + } + + public bool ResolveScriptExecutor(string className, string methodName) + { + if (_assemblyContext.ScriptAssembly == null) + { + return false; + } + + var resolver = new EntryPointResolver(Logger, className, methodName); + + EntryPoint = resolver.Resolve(_assemblyContext.ScriptAssembly); + + return EntryPoint != null; + } + + public bool Execute(IDbCommand command, IVariables variables) + { + return EntryPoint!.Execute(command, new VariablesProxy(variables)); + } + + public void Dispose() + { + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..9ba8ed0b --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.Adapter.AssemblyScripts.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/SqlDatabase.Adapter.AssemblyScripts.csproj b/Sources/SqlDatabase.Adapter.AssemblyScripts/SqlDatabase.Adapter.AssemblyScripts.csproj new file mode 100644 index 00000000..d9582000 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/SqlDatabase.Adapter.AssemblyScripts.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Adapter.AssemblyScripts/SubDomainFactory.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/SubDomainFactory.cs new file mode 100644 index 00000000..eac53a2f --- /dev/null +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/SubDomainFactory.cs @@ -0,0 +1,61 @@ +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SqlDatabase.Adapter.AssemblyScripts; + +internal static class SubDomainFactory +{ + public static void Test() + { + if (IsNetFrameworkRuntime()) + { + Test472SubDomain(); + } + else + { + Test472CoreSubDomain(); + } + } + + public static ISubDomain Create(ILogger logger, string assemblyFileName, Func readAssemblyContent) + { + if (IsNetFrameworkRuntime()) + { + return Create472SubDomain(logger, assemblyFileName, readAssemblyContent); + } + + return CreateCoreSubDomain(logger, assemblyFileName, readAssemblyContent); + } + + // https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed + private static bool IsNetFrameworkRuntime() + { + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + && RuntimeInformation.FrameworkDescription.IndexOf("Framework", StringComparison.OrdinalIgnoreCase) > 0; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static ISubDomain Create472SubDomain(ILogger logger, string assemblyFileName, Func readAssemblyContent) + { + return new Net472.Net472SubDomain(logger, assemblyFileName, readAssemblyContent); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Test472SubDomain() + { + Net472.Net472SubDomain.Test(); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static ISubDomain CreateCoreSubDomain(ILogger logger, string assemblyFileName, Func readAssemblyContent) + { + return new NetCore.NetCoreSubDomain(logger, assemblyFileName, readAssemblyContent); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Test472CoreSubDomain() + { + NetCore.NetCoreSubDomain.Test(); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/VariablesProxy.cs b/Sources/SqlDatabase.Adapter.AssemblyScripts/VariablesProxy.cs similarity index 71% rename from Sources/SqlDatabase/Scripts/AssemblyInternal/VariablesProxy.cs rename to Sources/SqlDatabase.Adapter.AssemblyScripts/VariablesProxy.cs index ca1d1f74..de7598a2 100644 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/VariablesProxy.cs +++ b/Sources/SqlDatabase.Adapter.AssemblyScripts/VariablesProxy.cs @@ -1,10 +1,11 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; -namespace SqlDatabase.Scripts.AssemblyInternal; +namespace SqlDatabase.Adapter.AssemblyScripts; -internal sealed class VariablesProxy : MarshalByRefObject, IReadOnlyDictionary +internal sealed class VariablesProxy : MarshalByRefObject, IReadOnlyDictionary { private readonly IVariables _variables; @@ -19,20 +20,20 @@ public VariablesProxy(IVariables variables) public IEnumerable Values => throw new NotSupportedException(); - public string this[string key] => _variables.GetValue(key); + public string? this[string key] => _variables.GetValue(key); public bool ContainsKey(string key) { return _variables.GetValue(key) != null; } - public bool TryGetValue(string key, out string value) + public bool TryGetValue(string key, [NotNullWhen(true)] out string? value) { value = _variables.GetValue(key); return value != null; } - public IEnumerator> GetEnumerator() + public IEnumerator> GetEnumerator() { throw new NotSupportedException(); } diff --git a/Sources/SqlDatabase.Test/Export/MsSqlDataExporterTest.cs b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDataExporterTest.cs similarity index 85% rename from Sources/SqlDatabase.Test/Export/MsSqlDataExporterTest.cs rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDataExporterTest.cs index 99e67446..ce522bdf 100644 --- a/Sources/SqlDatabase.Test/Export/MsSqlDataExporterTest.cs +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDataExporterTest.cs @@ -6,16 +6,16 @@ using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Scripts.MsSql; +using SqlDatabase.Adapter.Sql.Export; using SqlDatabase.TestApi; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter.MsSql; [TestFixture] public class MsSqlDataExporterTest { - private StringBuilder _output; - private DataExporter _sut; + private StringBuilder _output = null!; + private DataExporter _sut = null!; [SetUp] public void BeforeEachTest() @@ -25,7 +25,7 @@ public void BeforeEachTest() var log = new Mock(MockBehavior.Strict); log .Setup(l => l.Info(It.IsAny())) - .Callback(m => Console.WriteLine("Info: {0}", m)); + .Callback(m => TestOutput.WriteLine("Info: {0}", m)); _sut = new DataExporter { @@ -50,7 +50,7 @@ public void Export(string dataType, object minValue, object maxValue) script.Text("SELECT * FROM @input"); - using (var connection = new SqlConnection(MsSqlQuery.ConnectionString)) + using (var connection = new SqlConnection(MsSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = sql.ToString(); @@ -63,11 +63,11 @@ public void Export(string dataType, object minValue, object maxValue) } var exportSql = _output.ToString(); - Console.WriteLine(exportSql); + TestOutput.WriteLine(exportSql); exportSql.ShouldContain(" " + dataType + " "); - using (var connection = new SqlConnection(MsSqlQuery.ConnectionString)) + using (var connection = new SqlConnection(MsSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = exportSql.Replace("GO", string.Empty) + "\r\n\r\nSELECT * FROM #tmp"; @@ -90,7 +90,7 @@ public void Export(string dataType, object minValue, object maxValue) [Test] public void ExportReplaceRowVersionWithVarbinary() { - using (var connection = new SqlConnection(MsSqlQuery.ConnectionString)) + using (var connection = new SqlConnection(MsSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = @" @@ -110,9 +110,9 @@ insert into @x(Id) values(1) } var exportSql = _output.ToString(); - Console.WriteLine(exportSql); + TestOutput.WriteLine(exportSql); - using (var connection = new SqlConnection(MsSqlQuery.ConnectionString)) + using (var connection = new SqlConnection(MsSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = exportSql.Replace("GO", string.Empty) + "\r\n\r\nSELECT * FROM #tmp"; @@ -129,7 +129,7 @@ insert into @x(Id) values(1) [Test] public void ExportHierarchyId() { - using (var connection = new SqlConnection(MsSqlQuery.ConnectionString)) + using (var connection = new SqlConnection(MsSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = @" @@ -150,7 +150,7 @@ public void EmptySchemaTable() { ExportTable actual; - using (var connection = new SqlConnection(MsSqlQuery.ConnectionString)) + using (var connection = new SqlConnection(MsSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = "select 1, N'2' x, NULL"; @@ -183,7 +183,7 @@ public void InsertBatchSize() string slq500; string slq2; - using (var connection = new SqlConnection(MsSqlQuery.ConnectionString)) + using (var connection = new SqlConnection(MsSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = "select * from sys.databases"; @@ -204,7 +204,7 @@ public void InsertBatchSize() } } - Console.WriteLine(slq2); + TestOutput.WriteLine(slq2); slq2.Length.ShouldBeGreaterThan(slq500.Length); } @@ -244,11 +244,11 @@ private static IEnumerable GetExportCases() yield return new TestCaseData("BINARY", new[] { byte.MinValue }, new[] { byte.MaxValue }) { TestName = "BINARY" }; yield return new TestCaseData("BINARY(2)", new[] { byte.MinValue, byte.MinValue }, new[] { byte.MaxValue, byte.MaxValue }) { TestName = "BINARY(2)" }; - yield return new TestCaseData("VARBINARY", new byte[0], new[] { byte.MinValue }) { TestName = "VARBINARY" }; - yield return new TestCaseData("VARBINARY(3)", new byte[0], new byte[] { byte.MinValue, 2, byte.MaxValue }) { TestName = "VARBINARY(3)" }; - yield return new TestCaseData("VARBINARY(MAX)", new byte[0], new byte[] { byte.MinValue, 2, byte.MaxValue }) { TestName = "VARBINARY(MAX)" }; + yield return new TestCaseData("VARBINARY", Array.Empty(), new[] { byte.MinValue }) { TestName = "VARBINARY" }; + yield return new TestCaseData("VARBINARY(3)", Array.Empty(), new byte[] { byte.MinValue, 2, byte.MaxValue }) { TestName = "VARBINARY(3)" }; + yield return new TestCaseData("VARBINARY(MAX)", Array.Empty(), new byte[] { byte.MinValue, 2, byte.MaxValue }) { TestName = "VARBINARY(MAX)" }; - yield return new TestCaseData("IMAGE", new byte[0], new byte[] { byte.MinValue, 2, byte.MaxValue }) { TestName = "IMAGE" }; + yield return new TestCaseData("IMAGE", Array.Empty(), new byte[] { byte.MinValue, 2, byte.MaxValue }) { TestName = "IMAGE" }; var date = new DateTime(2019, 04, 22, 15, 42, 30); yield return new TestCaseData("DATE", date.Date, date.Date) { TestName = "DATE" }; diff --git a/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDatabaseAdapterFactoryTest.cs b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDatabaseAdapterFactoryTest.cs new file mode 100644 index 00000000..204fada7 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDatabaseAdapterFactoryTest.cs @@ -0,0 +1,14 @@ +using NUnit.Framework; +using Shouldly; + +namespace SqlDatabase.Adapter.MsSql; + +[TestFixture] +public class MsSqlDatabaseAdapterFactoryTest +{ + [Test] + public void CanBe() + { + MsSqlDatabaseAdapterFactory.CanBe(MsSqlQuery.GetConnectionString()).ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlDatabaseAdapterTest.cs b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDatabaseAdapterTest.cs similarity index 86% rename from Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlDatabaseAdapterTest.cs rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDatabaseAdapterTest.cs index dce00f37..d3b86445 100644 --- a/Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlDatabaseAdapterTest.cs +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlDatabaseAdapterTest.cs @@ -1,13 +1,11 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Configuration; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MsSql; +namespace SqlDatabase.Adapter.MsSql; [TestFixture] public class MsSqlDatabaseAdapterTest @@ -16,9 +14,8 @@ public class MsSqlDatabaseAdapterTest private const string SelectModuleVersion = "SELECT value from sys.fn_listextendedproperty('version-{{ModuleName}}', default, default, default, default, default, default)"; private const string UpdateModuleVersion = "EXEC sys.sp_updateextendedproperty @name=N'version-{{ModuleName}}', @value=N'{{TargetVersion}}'"; - private MsSqlDatabaseAdapter _sut; - private AppConfiguration _configuration; - private IList _logOutput; + private MsSqlDatabaseAdapter _sut = null!; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() @@ -29,16 +26,11 @@ public void BeforeEachTest() .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); - _configuration = new AppConfiguration(); - - _sut = new MsSqlDatabaseAdapter( - MsSqlQuery.ConnectionString, - _configuration, - log.Object); + _sut = new MsSqlDatabaseAdapter(MsSqlQuery.GetConnectionString(), null!, null!, log.Object); } [Test] @@ -75,7 +67,7 @@ public void GetServerVersionSelectScript() connection.Open(); var actual = cmd.ExecuteScalar(); - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldBeOfType().ShouldNotBeNullOrWhiteSpace(); } @@ -129,8 +121,11 @@ public void SqlOutputIntoLog(string script, string expected) [Test] public void GetSetVersionScriptDefault() { - _sut.GetVersionSelectScript().ShouldBe(MsSqlDatabaseAdapter.DefaultSelectVersion); - _sut.GetVersionUpdateScript().ShouldBe(MsSqlDatabaseAdapter.DefaultUpdateVersion); + _sut.GetCurrentVersionScript = MsSqlDefaults.DefaultSelectVersion; + _sut.SetCurrentVersionScript = MsSqlDefaults.DefaultUpdateVersion; + + _sut.GetVersionSelectScript().ShouldBe(MsSqlDefaults.DefaultSelectVersion); + _sut.GetVersionUpdateScript().ShouldBe(MsSqlDefaults.DefaultUpdateVersion); using (var connection = _sut.CreateConnection(false)) { @@ -158,8 +153,8 @@ public void GetSetVersionScriptDefault() [Test] public void GetSetVersionScriptModuleName() { - _configuration.GetCurrentVersionScript = SelectModuleVersion; - _configuration.SetCurrentVersionScript = UpdateModuleVersion; + _sut.GetCurrentVersionScript = SelectModuleVersion; + _sut.SetCurrentVersionScript = UpdateModuleVersion; _sut.GetVersionSelectScript().ShouldBe(SelectModuleVersion); _sut.GetVersionUpdateScript().ShouldBe(UpdateModuleVersion); diff --git a/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlQuery.cs b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlQuery.cs new file mode 100644 index 00000000..7e710597 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlQuery.cs @@ -0,0 +1,30 @@ +using System.Data.SqlClient; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Adapter.MsSql; + +internal static class MsSqlQuery +{ + public static string GetConnectionString() + { + return ConfigurationExtensions.GetConnectionString("mssql"); + } + + public static SqlConnection Open() + { + var con = new SqlConnection(GetConnectionString()); + con.Open(); + + return con; + } + + public static object? ExecuteScalar(string sql) + { + using (var connection = Open()) + using (var cmd = connection.CreateCommand()) + { + cmd.CommandText = sql; + return cmd.ExecuteScalar(); + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/Case01.sql b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/Case01.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/Case01.sql rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/Case01.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/Case02.sql b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/Case02.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/Case02.sql rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/Case02.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/CaseOneLineComment.sql b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/CaseOneLineComment.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/CaseOneLineComment.sql rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/CaseOneLineComment.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/CaseStoredProcedure.sql b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/CaseStoredProcedure.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Go/CaseStoredProcedure.sql rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.Go/CaseStoredProcedure.sql diff --git a/Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlTextReaderTest.cs b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.cs similarity index 68% rename from Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlTextReaderTest.cs rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.cs index f26600df..5a10012c 100644 --- a/Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlTextReaderTest.cs +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlTextReaderTest.cs @@ -3,14 +3,14 @@ using System.Text; using NUnit.Framework; using Shouldly; -using SqlDatabase.Scripts.SqlTestCases; +using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MsSql; +namespace SqlDatabase.Adapter.MsSql; [TestFixture] public class MsSqlTextReaderTest { - private MsSqlTextReader _sut; + private MsSqlTextReader _sut = null!; [SetUp] public void BeforeEachTest() @@ -34,23 +34,21 @@ public void IsGo(string line, bool expected) [Test] [TestCaseSource(nameof(GetSplitByGoTestCases))] - public void SplitByGo(Stream input, string[] expected) + public void SplitByGo(byte[] input, string[] expected) { - var batches = _sut.ReadBatches(input); + var batches = _sut.ReadBatches(new MemoryStream(input)); batches.ShouldBe(expected); - input.Position = 0; - - var first = _sut.ReadFirstBatch(input); + var first = _sut.ReadFirstBatch(new MemoryStream(input)); first.ShouldBe(expected[0]); } private static IEnumerable GetSplitByGoTestCases() { - foreach (var testCase in ResourceReader.Read("Go")) + foreach (var testCase in ResourceReader.Read(typeof(MsSqlTextReaderTest).Assembly, "MsSqlTextReaderTest.Go")) { yield return new TestCaseData( - new MemoryStream(Encoding.Default.GetBytes(testCase.Input)), + Encoding.Default.GetBytes(testCase.Input), testCase.Expected) { TestName = testCase.Name diff --git a/Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlWriterTest.cs b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlWriterTest.cs similarity index 93% rename from Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlWriterTest.cs rename to Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlWriterTest.cs index 88ca1fea..ba1579e6 100644 --- a/Sources/SqlDatabase.Test/Scripts/MsSql/MsSqlWriterTest.cs +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/MsSqlWriterTest.cs @@ -5,13 +5,13 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MsSql; +namespace SqlDatabase.Adapter.MsSql; [TestFixture] public class MsSqlWriterTest { - private StringBuilder _output; - private MsSqlWriter _sut; + private StringBuilder _output = null!; + private MsSqlWriter _sut = null!; [SetUp] public void BeforeEachTest() @@ -23,7 +23,7 @@ public void BeforeEachTest() [TearDown] public void AfterEachTest() { - Console.WriteLine(_output); + TestOutput.WriteLine(_output); } [Test] diff --git a/Sources/SqlDatabase.Adapter.MsSql.Test/SqlDatabase.Adapter.MsSql.Test.csproj b/Sources/SqlDatabase.Adapter.MsSql.Test/SqlDatabase.Adapter.MsSql.Test.csproj new file mode 100644 index 00000000..184b29ef --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/SqlDatabase.Adapter.MsSql.Test.csproj @@ -0,0 +1,23 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Adapter.MsSql + + + + + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/Scripts/MsSql/TextScriptOutputMsSqlTest.cs b/Sources/SqlDatabase.Adapter.MsSql.Test/TextScriptOutputMsSqlTest.cs similarity index 68% rename from Sources/SqlDatabase.Test/Scripts/MsSql/TextScriptOutputMsSqlTest.cs rename to Sources/SqlDatabase.Adapter.MsSql.Test/TextScriptOutputMsSqlTest.cs index 394eabb5..4fd8f8dd 100644 --- a/Sources/SqlDatabase.Test/Scripts/MsSql/TextScriptOutputMsSqlTest.cs +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/TextScriptOutputMsSqlTest.cs @@ -4,43 +4,39 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter.Sql; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MsSql; +namespace SqlDatabase.Adapter.MsSql; [TestFixture] public class TextScriptOutputMsSqlTest { - private SqlConnection _connection; - private SqlCommand _command; - private Mock _logger; - private Variables _variables; - private TextScript _sut; + private SqlConnection _connection = null!; + private SqlCommand _command = null!; + private Mock _logger = null!; + private Mock _variables = null!; - private IList _logOutput; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() { - _variables = new Variables(); + _variables = new Mock(MockBehavior.Strict); _logOutput = new List(); _logger = new Mock(MockBehavior.Strict); _logger .Setup(l => l.Indent()) - .Returns((IDisposable)null); + .Returns((IDisposable)null!); _logger .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); - _sut = new TextScript - { - TextReader = new MsSqlTextReader() - }; _connection = MsSqlQuery.Open(); _command = _connection.CreateCommand(); } @@ -55,9 +51,9 @@ public void AfterEachTest() [Test] public void ExecuteEmpty() { - _sut.ReadSqlContent = "/* do nothing */".AsFuncStream(); + var sut = CreateSut("/* do nothing */"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.ShouldBeEmpty(); } @@ -65,7 +61,7 @@ public void ExecuteEmpty() [Test] public void ExecuteDdlWithReader() { - _sut.ReadSqlContent = @" + var sut = CreateSut(@" create table dbo.TextScriptIntegrationTest(Id int, Name nvarchar(20)) go insert into dbo.TextScriptIntegrationTest values(1, 'name 1') @@ -73,10 +69,9 @@ insert into dbo.TextScriptIntegrationTest values(2, 'name 2') go select * from dbo.TextScriptIntegrationTest go -drop table dbo.TextScriptIntegrationTest" - .AsFuncStream(); +drop table dbo.TextScriptIntegrationTest"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(8); _logOutput[0].ShouldBe("output: Id; Name"); @@ -92,9 +87,9 @@ drop table dbo.TextScriptIntegrationTest" [Test] public void NoColumnName() { - _sut.ReadSqlContent = "select 1".AsFuncStream(); + var sut = CreateSut("select 1"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(4); _logOutput[0].ShouldBe("output: (no name)"); @@ -106,9 +101,9 @@ public void NoColumnName() [Test] public void SelectNull() { - _sut.ReadSqlContent = "select null".AsFuncStream(); + var sut = CreateSut("select null"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(4); _logOutput[0].ShouldBe("output: (no name)"); @@ -120,12 +115,11 @@ public void SelectNull() [Test] public void TwoSelections() { - _sut.ReadSqlContent = @" + var sut = CreateSut(@" select 1 first -select 2 second" - .AsFuncStream(); +select 2 second"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(9); @@ -145,12 +139,18 @@ select 2 second" [Test] public void SelectZeroRowsNull() { - _sut.ReadSqlContent = "select top 0 null value".AsFuncStream(); + var sut = CreateSut("select top 0 null value"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(2); _logOutput[0].ShouldBe("output: value"); _logOutput[1].ShouldBe("0 rows selected"); } + + private IScript CreateSut(string sql) + { + var file = FileFactory.File("dummy.sql", sql); + return new TextScriptFactory(new MsSqlTextReader()).FromFile(file); + } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MsSql.Test/app.config b/Sources/SqlDatabase.Adapter.MsSql.Test/app.config new file mode 100644 index 00000000..6c81a12a --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql.Test/app.config @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/MsSql/MsSqlDatabaseAdapter.cs b/Sources/SqlDatabase.Adapter.MsSql/MsSqlDatabaseAdapter.cs similarity index 52% rename from Sources/SqlDatabase/Scripts/MsSql/MsSqlDatabaseAdapter.cs rename to Sources/SqlDatabase.Adapter.MsSql/MsSqlDatabaseAdapter.cs index 442fe36f..7b3f9899 100644 --- a/Sources/SqlDatabase/Scripts/MsSql/MsSqlDatabaseAdapter.cs +++ b/Sources/SqlDatabase.Adapter.MsSql/MsSqlDatabaseAdapter.cs @@ -1,29 +1,25 @@ using System.Data; using System.Data.SqlClient; using System.IO; -using SqlDatabase.Configuration; -using SqlDatabase.Export; -namespace SqlDatabase.Scripts.MsSql; +namespace SqlDatabase.Adapter.MsSql; internal sealed class MsSqlDatabaseAdapter : IDatabaseAdapter { - public const string DefaultSelectVersion = "SELECT value from sys.fn_listextendedproperty('version', default, default, default, default, default, default)"; - public const string DefaultUpdateVersion = "EXEC sys.sp_updateextendedproperty @name=N'version', @value=N'{{TargetVersion}}'"; - private readonly string _connectionString; private readonly string _connectionStringMaster; - private readonly AppConfiguration _configuration; private readonly ILogger _log; private readonly SqlInfoMessageEventHandler _onConnectionInfoMessage; public MsSqlDatabaseAdapter( string connectionString, - AppConfiguration configuration, + string getCurrentVersionScript, + string setCurrentVersionScript, ILogger log) { + GetCurrentVersionScript = getCurrentVersionScript; + SetCurrentVersionScript = setCurrentVersionScript; _connectionString = connectionString; - _configuration = configuration; _log = log; var builder = new SqlConnectionStringBuilder(connectionString); @@ -36,10 +32,14 @@ public MsSqlDatabaseAdapter( public string DatabaseName { get; } + public string GetCurrentVersionScript { get; internal set; } + + public string SetCurrentVersionScript { get; internal set; } + public string GetUserFriendlyConnectionString() { var cs = new SqlConnectionStringBuilder(_connectionString); - return "database [{0}] on [{1}]".FormatWith(cs.InitialCatalog, cs.DataSource); + return $"database [{cs.InitialCatalog}] on [{cs.DataSource}]"; } public ISqlTextReader CreateSqlTextReader() => new MsSqlTextReader(); @@ -58,42 +58,14 @@ public IDbConnection CreateConnection(bool switchToMaster) public string GetServerVersionSelectScript() => "select @@version"; - public string GetDatabaseExistsScript(string databaseName) => "SELECT 1 FROM sys.databases WHERE Name=N'{0}'".FormatWith(databaseName); + public string GetDatabaseExistsScript(string databaseName) => $"SELECT 1 FROM sys.databases WHERE Name=N'{databaseName}'"; - public string GetVersionSelectScript() - { - var script = _configuration.MsSql.GetCurrentVersionScript; - if (string.IsNullOrWhiteSpace(script)) - { - script = _configuration.GetCurrentVersionScript; - } - - if (string.IsNullOrWhiteSpace(script)) - { - script = DefaultSelectVersion; - } - - return script; - } + public string GetVersionSelectScript() => GetCurrentVersionScript; - public string GetVersionUpdateScript() - { - var script = _configuration.MsSql.SetCurrentVersionScript; - if (string.IsNullOrWhiteSpace(script)) - { - script = _configuration.SetCurrentVersionScript; - } - - if (string.IsNullOrWhiteSpace(script)) - { - script = DefaultUpdateVersion; - } - - return script; - } + public string GetVersionUpdateScript() => SetCurrentVersionScript; private void OnConnectionInfoMessage(object sender, SqlInfoMessageEventArgs e) { - _log.Info("output: {0}".FormatWith(e.ToString())); + _log.Info($"output: {e}"); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MsSql/MsSqlDatabaseAdapterFactory.cs b/Sources/SqlDatabase.Adapter.MsSql/MsSqlDatabaseAdapterFactory.cs new file mode 100644 index 00000000..dc499f62 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql/MsSqlDatabaseAdapterFactory.cs @@ -0,0 +1,51 @@ +using System; +using System.Data.Common; +using System.Data.SqlClient; + +namespace SqlDatabase.Adapter.MsSql; + +public static class MsSqlDatabaseAdapterFactory +{ + public static bool CanBe(string connectionString) + { + if (!IsMsSql(connectionString)) + { + return false; + } + + var builder = new DbConnectionStringBuilder(false) { ConnectionString = connectionString }; + return builder.ContainsKey("Data Source") && builder.ContainsKey("Initial Catalog"); + } + + public static IDatabaseAdapter CreateAdapter( + string connectionString, + string? getCurrentVersionScript, + string? setCurrentVersionScript, + ILogger log) + { + return new MsSqlDatabaseAdapter( + connectionString, + string.IsNullOrWhiteSpace(getCurrentVersionScript) ? MsSqlDefaults.DefaultSelectVersion : getCurrentVersionScript!, + string.IsNullOrWhiteSpace(setCurrentVersionScript) ? MsSqlDefaults.DefaultUpdateVersion : setCurrentVersionScript!, + log); + } + + private static bool IsMsSql(string connectionString) + { + var builder = new SqlConnectionStringBuilder(); + + try + { + builder.ConnectionString = connectionString; + return true; + } + catch (ArgumentException) + { + return false; + } + catch (FormatException) + { + return false; + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MsSql/MsSqlDefaults.cs b/Sources/SqlDatabase.Adapter.MsSql/MsSqlDefaults.cs new file mode 100644 index 00000000..2bb7eaec --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql/MsSqlDefaults.cs @@ -0,0 +1,7 @@ +namespace SqlDatabase.Adapter.MsSql; + +internal static class MsSqlDefaults +{ + public const string DefaultSelectVersion = "SELECT value from sys.fn_listextendedproperty('version', default, default, default, default, default, default)"; + public const string DefaultUpdateVersion = "EXEC sys.sp_updateextendedproperty @name=N'version', @value=N'{{TargetVersion}}'"; +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/MsSql/MsSqlTextReader.cs b/Sources/SqlDatabase.Adapter.MsSql/MsSqlTextReader.cs similarity index 92% rename from Sources/SqlDatabase/Scripts/MsSql/MsSqlTextReader.cs rename to Sources/SqlDatabase.Adapter.MsSql/MsSqlTextReader.cs index 6c49231c..8c3be1e9 100644 --- a/Sources/SqlDatabase/Scripts/MsSql/MsSqlTextReader.cs +++ b/Sources/SqlDatabase.Adapter.MsSql/MsSqlTextReader.cs @@ -4,13 +4,13 @@ using System.Text; using System.Text.RegularExpressions; -namespace SqlDatabase.Scripts.MsSql; +namespace SqlDatabase.Adapter.MsSql; internal sealed class MsSqlTextReader : ISqlTextReader { private readonly Regex _goRegex = new Regex("^(\\s*(go)+\\s*)+$", RegexOptions.Compiled | RegexOptions.IgnoreCase); - public string ReadFirstBatch(Stream sql) + public string? ReadFirstBatch(Stream sql) { return ReadBatches(sql).FirstOrDefault(); } @@ -52,7 +52,7 @@ private static IEnumerable ReadLines(Stream sql) { using (var reader = new StreamReader(sql)) { - string line; + string? line; while ((line = reader.ReadLine()) != null) { yield return line; diff --git a/Sources/SqlDatabase/Scripts/MsSql/MsSqlWriter.cs b/Sources/SqlDatabase.Adapter.MsSql/MsSqlWriter.cs similarity index 93% rename from Sources/SqlDatabase/Scripts/MsSql/MsSqlWriter.cs rename to Sources/SqlDatabase.Adapter.MsSql/MsSqlWriter.cs index 1df7ab2f..2b873c97 100644 --- a/Sources/SqlDatabase/Scripts/MsSql/MsSqlWriter.cs +++ b/Sources/SqlDatabase.Adapter.MsSql/MsSqlWriter.cs @@ -4,9 +4,8 @@ using System.IO; using System.Linq; using System.Text; -using SqlDatabase.Export; -namespace SqlDatabase.Scripts.MsSql; +namespace SqlDatabase.Adapter.MsSql; internal sealed class MsSqlWriter : SqlWriterBase { @@ -44,7 +43,7 @@ public override SqlWriterBase BatchSeparator() public override SqlWriterBase DataType(string typeName, int size, int precision, int scale) { var name = typeName.ToUpperInvariant(); - string sizeText = null; + string? sizeText = null; switch (name) { @@ -56,7 +55,7 @@ public override SqlWriterBase DataType(string typeName, int size, int precision, case "DECIMAL": if (scale != 0) { - sizeText = "{0},{1}".FormatWith(precision, scale); + sizeText = $"{precision},{scale}"; } else if (precision != 18) { @@ -100,7 +99,7 @@ public override SqlWriterBase DataType(string typeName, int size, int precision, public override ExportTable ReadSchemaTable(DataTable metadata, string tableName) { - var result = new ExportTable { Name = tableName }; + var result = new ExportTable(tableName); const string GeneratedName = "GeneratedName"; var generatedIndex = 0; @@ -127,7 +126,7 @@ public override ExportTable ReadSchemaTable(DataTable metadata, string tableName else if (typeName.EndsWith("sys.HIERARCHYID", StringComparison.OrdinalIgnoreCase)) { // System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies - throw new NotSupportedException("Data type hierarchyid is not supported, to export data convert value to NVARCHAR: SELECT CAST([{0}] AND NVARCHAR(100)) [{0}]".FormatWith(name)); + throw new NotSupportedException($"Data type hierarchyid is not supported, to export data convert value to NVARCHAR: SELECT CAST([{name}] AND NVARCHAR(100)) [{name}]"); } result.Columns.Add(new ExportTableColumn @@ -146,7 +145,7 @@ public override ExportTable ReadSchemaTable(DataTable metadata, string tableName public override string GetDefaultTableName() => "dbo.SqlDatabaseExport"; - protected override bool TryWriteValue(object value, string typeNameHint) + protected override bool TryWriteValue(object value, string? typeNameHint) { var type = value.GetType(); diff --git a/Sources/SqlDatabase.Adapter.MsSql/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Adapter.MsSql/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0c47a6bd --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.Adapter.MsSql.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MsSql/SqlDatabase.Adapter.MsSql.csproj b/Sources/SqlDatabase.Adapter.MsSql/SqlDatabase.Adapter.MsSql.csproj new file mode 100644 index 00000000..80a96461 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MsSql/SqlDatabase.Adapter.MsSql.csproj @@ -0,0 +1,20 @@ + + + + net472;netstandard2.0 + bin\ + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/Export/MySqlDataExporterTest.cs b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlDataExporterTest.cs similarity index 97% rename from Sources/SqlDatabase.Test/Export/MySqlDataExporterTest.cs rename to Sources/SqlDatabase.Adapter.MySql.Test/MySqlDataExporterTest.cs index f6e0bbe7..4e1d9781 100644 --- a/Sources/SqlDatabase.Test/Export/MySqlDataExporterTest.cs +++ b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlDataExporterTest.cs @@ -5,16 +5,16 @@ using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Scripts.MySql; +using SqlDatabase.Adapter.Sql.Export; using SqlDatabase.TestApi; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter.MySql; [TestFixture] public class MySqlDataExporterTest { - private StringBuilder _output; - private DataExporter _sut; + private StringBuilder _output = null!; + private DataExporter _sut = null!; [SetUp] public void BeforeEachTest() @@ -24,7 +24,7 @@ public void BeforeEachTest() var log = new Mock(MockBehavior.Strict); log .Setup(l => l.Info(It.IsAny())) - .Callback(m => Console.WriteLine("Info: {0}", m)); + .Callback(m => TestOutput.WriteLine("Info: {0}", m)); _sut = new DataExporter { @@ -67,7 +67,7 @@ public void Export(string dataType, object minValue, object maxValue, bool allow } var exportSql = _output.ToString(); - Console.WriteLine(exportSql); + TestOutput.WriteLine(exportSql); exportSql.ShouldContain(" " + (expectedDataType ?? dataType) + " "); diff --git a/Sources/SqlDatabase.Test/Scripts/MySql/MySqlDatabaseAdapterTest.cs b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlDatabaseAdapterTest.cs similarity index 85% rename from Sources/SqlDatabase.Test/Scripts/MySql/MySqlDatabaseAdapterTest.cs rename to Sources/SqlDatabase.Adapter.MySql.Test/MySqlDatabaseAdapterTest.cs index aa8f123c..0a0528c7 100644 --- a/Sources/SqlDatabase.Test/Scripts/MySql/MySqlDatabaseAdapterTest.cs +++ b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlDatabaseAdapterTest.cs @@ -1,13 +1,11 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Configuration; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MySql; +namespace SqlDatabase.Adapter.MySql; [TestFixture] public class MySqlDatabaseAdapterTest @@ -16,9 +14,8 @@ public class MySqlDatabaseAdapterTest private const string SelectModuleVersion = "SELECT version FROM version WHERE module_name = '{{ModuleName}}'"; private const string UpdateModuleVersion = "UPDATE version SET version='{{TargetVersion}}' WHERE module_name = '{{ModuleName}}'"; - private MySqlDatabaseAdapter _sut; - private AppConfiguration _configuration; - private IList _logOutput; + private MySqlDatabaseAdapter _sut = null!; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() @@ -29,16 +26,11 @@ public void BeforeEachTest() .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); - _configuration = new AppConfiguration(); - - _sut = new MySqlDatabaseAdapter( - MySqlQuery.ConnectionString, - _configuration, - log.Object); + _sut = new MySqlDatabaseAdapter(MySqlQuery.GetConnectionString(), null!, null!, log.Object); } [Test] @@ -75,7 +67,7 @@ public void GetServerVersionSelectScript() connection.Open(); var actual = cmd.ExecuteScalar(); - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldBeOfType().ShouldNotBeNullOrWhiteSpace(); } @@ -128,8 +120,11 @@ public void SqlOutputIntoLog() [Test] public void GetSetVersionScriptDefault() { - _sut.GetVersionSelectScript().ShouldBe(MySqlDatabaseAdapter.DefaultSelectVersion); - _sut.GetVersionUpdateScript().ShouldBe(MySqlDatabaseAdapter.DefaultUpdateVersion); + _sut.GetCurrentVersionScript = MySqlDefaults.DefaultSelectVersion; + _sut.SetCurrentVersionScript = MySqlDefaults.DefaultUpdateVersion; + + _sut.GetVersionSelectScript().ShouldBe(MySqlDefaults.DefaultSelectVersion); + _sut.GetVersionUpdateScript().ShouldBe(MySqlDefaults.DefaultUpdateVersion); using (var connection = _sut.CreateConnection(false)) { @@ -157,8 +152,8 @@ public void GetSetVersionScriptDefault() [Test] public void GetSetVersionScriptModuleName() { - _configuration.GetCurrentVersionScript = SelectModuleVersion; - _configuration.SetCurrentVersionScript = UpdateModuleVersion; + _sut.GetCurrentVersionScript = SelectModuleVersion; + _sut.SetCurrentVersionScript = UpdateModuleVersion; _sut.GetVersionSelectScript().ShouldBe(SelectModuleVersion); _sut.GetVersionUpdateScript().ShouldBe(UpdateModuleVersion); diff --git a/Sources/SqlDatabase.Adapter.MySql.Test/MySqlQuery.cs b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlQuery.cs new file mode 100644 index 00000000..7b749568 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlQuery.cs @@ -0,0 +1,30 @@ +using MySqlConnector; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Adapter.MySql; + +internal static class MySqlQuery +{ + public static string GetConnectionString() + { + return ConfigurationExtensions.GetConnectionString("mysql"); + } + + public static MySqlConnection Open() + { + var con = new MySqlConnection(GetConnectionString()); + con.Open(); + + return con; + } + + public static object? ExecuteScalar(string sql) + { + using (var connection = Open()) + using (var cmd = connection.CreateCommand()) + { + cmd.CommandText = sql; + return cmd.ExecuteScalar(); + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/MySql/MySqlTextReaderTest.cs b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlTextReaderTest.cs similarity index 90% rename from Sources/SqlDatabase.Test/Scripts/MySql/MySqlTextReaderTest.cs rename to Sources/SqlDatabase.Adapter.MySql.Test/MySqlTextReaderTest.cs index ce6f18b4..58d71a68 100644 --- a/Sources/SqlDatabase.Test/Scripts/MySql/MySqlTextReaderTest.cs +++ b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlTextReaderTest.cs @@ -2,12 +2,12 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MySql; +namespace SqlDatabase.Adapter.MySql; [TestFixture] public class MySqlTextReaderTest { - private MySqlTextReader _sut; + private MySqlTextReader _sut = null!; [SetUp] public void BeforeEachTest() diff --git a/Sources/SqlDatabase.Test/Scripts/MySql/MySqlWriterTest.cs b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlWriterTest.cs similarity index 81% rename from Sources/SqlDatabase.Test/Scripts/MySql/MySqlWriterTest.cs rename to Sources/SqlDatabase.Adapter.MySql.Test/MySqlWriterTest.cs index 7a1e8366..c5bddbd1 100644 --- a/Sources/SqlDatabase.Test/Scripts/MySql/MySqlWriterTest.cs +++ b/Sources/SqlDatabase.Adapter.MySql.Test/MySqlWriterTest.cs @@ -5,13 +5,13 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MySql; +namespace SqlDatabase.Adapter.MySql; [TestFixture] public class MySqlWriterTest { - private StringBuilder _output; - private MySqlWriter _sut; + private StringBuilder _output = null!; + private MySqlWriter _sut = null!; [SetUp] public void BeforeEachTest() @@ -23,7 +23,7 @@ public void BeforeEachTest() [TearDown] public void AfterEachTest() { - Console.WriteLine(_output); + TestOutput.WriteLine(_output); } [Test] diff --git a/Sources/SqlDatabase.Adapter.MySql.Test/SqlDatabase.Adapter.MySql.Test.csproj b/Sources/SqlDatabase.Adapter.MySql.Test/SqlDatabase.Adapter.MySql.Test.csproj new file mode 100644 index 00000000..7ef1c4cf --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MySql.Test/SqlDatabase.Adapter.MySql.Test.csproj @@ -0,0 +1,19 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Adapter.MySql + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/MySql/TextScriptOutputMySqlTest.cs b/Sources/SqlDatabase.Adapter.MySql.Test/TextScriptOutputMySqlTest.cs similarity index 68% rename from Sources/SqlDatabase.Test/Scripts/MySql/TextScriptOutputMySqlTest.cs rename to Sources/SqlDatabase.Adapter.MySql.Test/TextScriptOutputMySqlTest.cs index 526f57de..7c2bbf2b 100644 --- a/Sources/SqlDatabase.Test/Scripts/MySql/TextScriptOutputMySqlTest.cs +++ b/Sources/SqlDatabase.Adapter.MySql.Test/TextScriptOutputMySqlTest.cs @@ -4,44 +4,39 @@ using MySqlConnector; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter.Sql; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.MySql; +namespace SqlDatabase.Adapter.MySql; [TestFixture] public class TextScriptOutputMySqlTest { - private MySqlConnection _connection; - private MySqlCommand _command; - private Mock _logger; - private Variables _variables; - private TextScript _sut; + private MySqlConnection _connection = null!; + private MySqlCommand _command = null!; + private Mock _logger = null!; + private Mock _variables = null!; - private IList _logOutput; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() { - _variables = new Variables(); + _variables = new Mock(MockBehavior.Strict); _logOutput = new List(); _logger = new Mock(MockBehavior.Strict); _logger .Setup(l => l.Indent()) - .Returns((IDisposable)null); + .Returns((IDisposable)null!); _logger .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); - _sut = new TextScript - { - TextReader = new MySqlTextReader() - }; - _connection = MySqlQuery.Open(); _command = _connection.CreateCommand(); } @@ -56,9 +51,9 @@ public void AfterEachTest() [Test] public void ExecuteEmpty() { - _sut.ReadSqlContent = "/* do nothing */".AsFuncStream(); + var sut = CreateSut("/* do nothing */"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.ShouldBeEmpty(); } @@ -66,7 +61,7 @@ public void ExecuteEmpty() [Test] public void ExecuteDdlWithReader() { - _sut.ReadSqlContent = @" + var sut = CreateSut(@" create table TextScriptIntegrationTest(id int, name varchar(20)); insert into TextScriptIntegrationTest values(1, 'name 1'); @@ -74,10 +69,9 @@ public void ExecuteDdlWithReader() select * from TextScriptIntegrationTest; -drop table TextScriptIntegrationTest;" - .AsFuncStream(); +drop table TextScriptIntegrationTest;"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(8); _logOutput[0].ShouldBe("output: id; name"); @@ -93,9 +87,9 @@ public void ExecuteDdlWithReader() [Test] public void NoColumnName() { - _sut.ReadSqlContent = "select 1".AsFuncStream(); + var sut = CreateSut("select 1"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(4); _logOutput[0].ShouldBe("output: 1"); @@ -107,9 +101,9 @@ public void NoColumnName() [Test] public void SelectNull() { - _sut.ReadSqlContent = "select null".AsFuncStream(); + var sut = CreateSut("select null"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(4); _logOutput[0].ShouldBe("output: NULL"); @@ -121,12 +115,11 @@ public void SelectNull() [Test] public void TwoSelections() { - _sut.ReadSqlContent = @" + var sut = CreateSut(@" select 1 first_; -select 2 second_;" - .AsFuncStream(); +select 2 second_;"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(9); @@ -146,12 +139,18 @@ public void TwoSelections() [Test] public void SelectZeroRowsNull() { - _sut.ReadSqlContent = "select null value_ limit 0".AsFuncStream(); + var sut = CreateSut("select null value_ limit 0"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(2); _logOutput[0].ShouldBe("output: value_"); _logOutput[1].ShouldBe("0 rows selected"); } + + private IScript CreateSut(string sql) + { + var file = FileFactory.File("dummy.sql", sql); + return new TextScriptFactory(new MySqlTextReader()).FromFile(file); + } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MySql.Test/app.config b/Sources/SqlDatabase.Adapter.MySql.Test/app.config new file mode 100644 index 00000000..3b818a59 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MySql.Test/app.config @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/MySql/MySqlDatabaseAdapter.cs b/Sources/SqlDatabase.Adapter.MySql/MySqlDatabaseAdapter.cs similarity index 55% rename from Sources/SqlDatabase/Scripts/MySql/MySqlDatabaseAdapter.cs rename to Sources/SqlDatabase.Adapter.MySql/MySqlDatabaseAdapter.cs index 5ddaad7b..08772aae 100644 --- a/Sources/SqlDatabase/Scripts/MySql/MySqlDatabaseAdapter.cs +++ b/Sources/SqlDatabase.Adapter.MySql/MySqlDatabaseAdapter.cs @@ -1,28 +1,24 @@ using System.Data; using System.IO; using MySqlConnector; -using SqlDatabase.Configuration; -using SqlDatabase.Export; -namespace SqlDatabase.Scripts.MySql; +namespace SqlDatabase.Adapter.MySql; internal sealed class MySqlDatabaseAdapter : IDatabaseAdapter { - public const string DefaultSelectVersion = "SELECT version FROM version WHERE module_name = 'database'"; - public const string DefaultUpdateVersion = "UPDATE version SET version='{{TargetVersion}}' WHERE module_name = 'database'"; - private readonly string _connectionString; private readonly string _connectionStringMaster; - private readonly AppConfiguration _configuration; private readonly ILogger _log; private readonly MySqlInfoMessageEventHandler _onConnectionInfoMessage; public MySqlDatabaseAdapter( string connectionString, - AppConfiguration configuration, + string getCurrentVersionScript, + string setCurrentVersionScript, ILogger log) { - _configuration = configuration; + GetCurrentVersionScript = getCurrentVersionScript; + SetCurrentVersionScript = setCurrentVersionScript; _log = log; var builder = new MySqlConnectionStringBuilder(connectionString); @@ -38,10 +34,14 @@ public MySqlDatabaseAdapter( public string DatabaseName { get; } + public string GetCurrentVersionScript { get; internal set; } + + public string SetCurrentVersionScript { get; internal set; } + public string GetUserFriendlyConnectionString() { var cs = new MySqlConnectionStringBuilder(_connectionString); - return "database [{0}] on [{1}]".FormatWith(cs.Database, cs.Server); + return $"database [{cs.Database}] on [{cs.Server}]"; } public ISqlTextReader CreateSqlTextReader() => new MySqlTextReader(); @@ -60,46 +60,18 @@ public IDbConnection CreateConnection(bool switchToMaster) public string GetServerVersionSelectScript() => "SELECT concat(@@version_comment, ', ', version(), ', ', @@version_compile_os)"; - public string GetDatabaseExistsScript(string databaseName) => "SELECT 1 FROM information_schema.schemata WHERE LOWER(schema_name) = LOWER('{0}')".FormatWith(databaseName); - - public string GetVersionSelectScript() - { - var script = _configuration.MySql.GetCurrentVersionScript; - if (string.IsNullOrWhiteSpace(script)) - { - script = _configuration.GetCurrentVersionScript; - } + public string GetDatabaseExistsScript(string databaseName) => $"SELECT 1 FROM information_schema.schemata WHERE LOWER(schema_name) = LOWER('{databaseName}')"; - if (string.IsNullOrWhiteSpace(script)) - { - script = DefaultSelectVersion; - } + public string GetVersionSelectScript() => GetCurrentVersionScript; - return script; - } - - public string GetVersionUpdateScript() - { - var script = _configuration.MySql.SetCurrentVersionScript; - if (string.IsNullOrWhiteSpace(script)) - { - script = _configuration.SetCurrentVersionScript; - } - - if (string.IsNullOrWhiteSpace(script)) - { - script = DefaultUpdateVersion; - } - - return script; - } + public string GetVersionUpdateScript() => SetCurrentVersionScript; private void OnConnectionInfoMessage(object sender, MySqlInfoMessageEventArgs args) { for (var i = 0; i < args.Errors.Count; i++) { var error = args.Errors[i]; - _log.Info("{0}: {1}".FormatWith(error.Level, error.Message)); + _log.Info($"{error.Level}: {error.Message}"); } } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MySql/MySqlDatabaseAdapterFactory.cs b/Sources/SqlDatabase.Adapter.MySql/MySqlDatabaseAdapterFactory.cs new file mode 100644 index 00000000..9645b99c --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MySql/MySqlDatabaseAdapterFactory.cs @@ -0,0 +1,51 @@ +using System; +using System.Data.Common; +using MySqlConnector; + +namespace SqlDatabase.Adapter.MySql; + +public static class MySqlDatabaseAdapterFactory +{ + public static bool CanBe(string connectionString) + { + if (!IsMsSql(connectionString)) + { + return false; + } + + var builder = new DbConnectionStringBuilder(false) { ConnectionString = connectionString }; + return builder.ContainsKey("Server") && builder.ContainsKey("Database"); + } + + public static IDatabaseAdapter CreateAdapter( + string connectionString, + string? getCurrentVersionScript, + string? setCurrentVersionScript, + ILogger log) + { + return new MySqlDatabaseAdapter( + connectionString, + string.IsNullOrWhiteSpace(getCurrentVersionScript) ? MySqlDefaults.DefaultSelectVersion : getCurrentVersionScript!, + string.IsNullOrWhiteSpace(setCurrentVersionScript) ? MySqlDefaults.DefaultUpdateVersion : setCurrentVersionScript!, + log); + } + + private static bool IsMsSql(string connectionString) + { + var builder = new MySqlConnectionStringBuilder(); + + try + { + builder.ConnectionString = connectionString; + return true; + } + catch (ArgumentException) + { + return false; + } + catch (FormatException) + { + return false; + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MySql/MySqlDefaults.cs b/Sources/SqlDatabase.Adapter.MySql/MySqlDefaults.cs new file mode 100644 index 00000000..8e0ea9c4 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MySql/MySqlDefaults.cs @@ -0,0 +1,7 @@ +namespace SqlDatabase.Adapter.MySql; + +internal static class MySqlDefaults +{ + public const string DefaultSelectVersion = "SELECT version FROM version WHERE module_name = 'database'"; + public const string DefaultUpdateVersion = "UPDATE version SET version='{{TargetVersion}}' WHERE module_name = 'database'"; +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/MySql/MySqlTextReader.cs b/Sources/SqlDatabase.Adapter.MySql/MySqlTextReader.cs similarity index 87% rename from Sources/SqlDatabase/Scripts/MySql/MySqlTextReader.cs rename to Sources/SqlDatabase.Adapter.MySql/MySqlTextReader.cs index b73be41b..d8de984d 100644 --- a/Sources/SqlDatabase/Scripts/MySql/MySqlTextReader.cs +++ b/Sources/SqlDatabase.Adapter.MySql/MySqlTextReader.cs @@ -1,22 +1,23 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; -namespace SqlDatabase.Scripts.MySql; +namespace SqlDatabase.Adapter.MySql; internal sealed class MySqlTextReader : ISqlTextReader { private const int MaxFirstBatchSize = 20; private readonly Regex _semicolonRegex = new Regex("^(\\s*;+\\s*)+$", RegexOptions.Compiled | RegexOptions.IgnoreCase); - public string ReadFirstBatch(Stream sql) + public string? ReadFirstBatch(Stream sql) { var script = new StringBuilder(); using (var reader = new StreamReader(sql)) { - string line; + string? line; var lineNumber = 0; while ((line = reader.ReadLine()) != null) { @@ -53,7 +54,7 @@ public IEnumerable ReadBatches(Stream sql) if (string.IsNullOrWhiteSpace(script)) { - return new string[0]; + return Array.Empty(); } return new[] { script }; diff --git a/Sources/SqlDatabase/Scripts/MySql/MySqlWriter.cs b/Sources/SqlDatabase.Adapter.MySql/MySqlWriter.cs similarity index 94% rename from Sources/SqlDatabase/Scripts/MySql/MySqlWriter.cs rename to Sources/SqlDatabase.Adapter.MySql/MySqlWriter.cs index 0feac799..9ce1136b 100644 --- a/Sources/SqlDatabase/Scripts/MySql/MySqlWriter.cs +++ b/Sources/SqlDatabase.Adapter.MySql/MySqlWriter.cs @@ -4,9 +4,8 @@ using System.IO; using System.Linq; using System.Text; -using SqlDatabase.Export; -namespace SqlDatabase.Scripts.MySql; +namespace SqlDatabase.Adapter.MySql; internal sealed class MySqlWriter : SqlWriterBase { @@ -32,7 +31,7 @@ public override SqlWriterBase BatchSeparator() public override SqlWriterBase DataType(string typeName, int size, int precision, int scale) { var name = typeName.ToUpperInvariant(); - string sizeText = null; + string? sizeText = null; switch (name) { @@ -59,7 +58,7 @@ public override SqlWriterBase DataType(string typeName, int size, int precision, case "BIGINT UNSIGNED": if (size != 0) { - name = name.Insert(name.IndexOf(' '), "({0})".FormatWith(size)); + name = name.Insert(name.IndexOf(' '), $"({size})"); } break; @@ -67,7 +66,7 @@ public override SqlWriterBase DataType(string typeName, int size, int precision, case "NUMERIC": if (scale != 0) { - sizeText = "{0},{1}".FormatWith(precision, scale); + sizeText = $"{precision},{scale}"; } else if (precision != 0) { @@ -94,7 +93,7 @@ public override SqlWriterBase DataType(string typeName, int size, int precision, public override ExportTable ReadSchemaTable(DataTable metadata, string tableName) { - var result = new ExportTable { Name = tableName }; + var result = new ExportTable(tableName); const string GeneratedName = "GeneratedName"; var generatedIndex = 0; @@ -126,7 +125,7 @@ public override ExportTable ReadSchemaTable(DataTable metadata, string tableName return result; } - protected override bool TryWriteValue(object value, string typeNameHint) + protected override bool TryWriteValue(object value, string? typeNameHint) { var type = value.GetType(); diff --git a/Sources/SqlDatabase.Adapter.MySql/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Adapter.MySql/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..58386af8 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MySql/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.Adapter.MySql.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.MySql/SqlDatabase.Adapter.MySql.csproj b/Sources/SqlDatabase.Adapter.MySql/SqlDatabase.Adapter.MySql.csproj new file mode 100644 index 00000000..fffa0e70 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.MySql/SqlDatabase.Adapter.MySql.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/Export/PgSqlDataExporterTest.cs b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlDataExporterTest.cs similarity index 93% rename from Sources/SqlDatabase.Test/Export/PgSqlDataExporterTest.cs rename to Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlDataExporterTest.cs index 752b47dc..45e2909b 100644 --- a/Sources/SqlDatabase.Test/Export/PgSqlDataExporterTest.cs +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlDataExporterTest.cs @@ -9,16 +9,16 @@ using NpgsqlTypes; using NUnit.Framework; using Shouldly; -using SqlDatabase.Scripts.PgSql; +using SqlDatabase.Adapter.Sql.Export; using SqlDatabase.TestApi; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter.PgSql; [TestFixture] public class PgSqlDataExporterTest { - private StringBuilder _output; - private DataExporter _sut; + private StringBuilder _output = null!; + private DataExporter _sut = null!; [SetUp] public void BeforeEachTest() @@ -28,7 +28,7 @@ public void BeforeEachTest() var log = new Mock(MockBehavior.Strict); log .Setup(l => l.Info(It.IsAny())) - .Callback(m => Console.WriteLine("Info: {0}", m)); + .Callback(m => TestOutput.WriteLine("Info: {0}", m)); _sut = new DataExporter { @@ -60,7 +60,7 @@ public void Export(string dataType, object minValue, object maxValue, bool allow script.Text("SELECT * FROM input_data;"); - using (var connection = new NpgsqlConnection(PgSqlQuery.ConnectionString)) + using (var connection = new NpgsqlConnection(PgSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = sql.ToString(); @@ -73,11 +73,11 @@ public void Export(string dataType, object minValue, object maxValue, bool allow } var exportSql = _output.ToString(); - Console.WriteLine(exportSql); + TestOutput.WriteLine(exportSql); exportSql.ShouldContain(" " + (expectedDataType ?? dataType) + " "); - using (var connection = new NpgsqlConnection(PgSqlQuery.ConnectionString)) + using (var connection = new NpgsqlConnection(PgSqlQuery.GetConnectionString())) using (var cmd = connection.CreateCommand()) { cmd.CommandText = exportSql.Replace("CREATE TABLE", "CREATE TEMP TABLE") + "\r\n\r\nSELECT * FROM test_data;"; @@ -121,14 +121,14 @@ private static void CompareValues(string dataType, object expected, object actua if (dataType.Equals("tsquery", StringComparison.OrdinalIgnoreCase)) { - actual.ShouldBeAssignableTo().ToString().ShouldBe(NpgsqlTsQuery.Parse((string)expected).ToString()); + actual.ShouldBeAssignableTo()!.ToString().ShouldBe(NpgsqlTsQuery.Parse((string)expected).ToString()); return; } if (expected is IDictionary compositeExpected) { var compositeActual = actual.ShouldBeAssignableTo>(); - compositeActual.Keys.ShouldBe(compositeExpected.Keys); + compositeActual!.Keys.ShouldBe(compositeExpected.Keys); foreach (var key in compositeExpected.Keys) { compositeActual[key].ShouldBe(compositeExpected[key]); @@ -180,7 +180,7 @@ private static IEnumerable GetExportCases() yield return new TestCaseData("public.citext", "abc", "d", true, null) { TestName = "public.citext" }; // Binary Data Types - yield return new TestCaseData("bytea", new byte[0], new[] { byte.MinValue, byte.MaxValue, (byte)10 }, true, null) { TestName = "bytea" }; + yield return new TestCaseData("bytea", Array.Empty(), new[] { byte.MinValue, byte.MaxValue, (byte)10 }, true, null) { TestName = "bytea" }; // Date/Time Types var date = new DateTime(2021, 05, 13, 18, 31, 30, 10); @@ -222,7 +222,7 @@ private static IEnumerable GetExportCases() yield return new TestCaseData("integer[3]", new[] { 1, 2, 3 }, new[] { -1, -2, 3 }, true, "integer[]") { TestName = "integer[3]" }; // Composite Types - IDictionary composite = new ExpandoObject(); + IDictionary composite = new ExpandoObject(); composite.Add("name", "fuzzy dice"); composite.Add("supplier_id", 42); composite.Add("price", 1.99); diff --git a/Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlDatabaseAdapterTest.cs b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlDatabaseAdapterTest.cs similarity index 85% rename from Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlDatabaseAdapterTest.cs rename to Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlDatabaseAdapterTest.cs index 2a8f41bd..7f9e5895 100644 --- a/Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlDatabaseAdapterTest.cs +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlDatabaseAdapterTest.cs @@ -1,13 +1,11 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Configuration; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.PgSql; +namespace SqlDatabase.Adapter.PgSql; [TestFixture] public class PgSqlDatabaseAdapterTest @@ -16,9 +14,8 @@ public class PgSqlDatabaseAdapterTest private const string SelectModuleVersion = "SELECT version FROM public.version WHERE module_name = '{{ModuleName}}'"; private const string UpdateModuleVersion = "UPDATE public.version SET version='{{TargetVersion}}' WHERE module_name = '{{ModuleName}}'"; - private PgSqlDatabaseAdapter _sut; - private AppConfiguration _configuration; - private IList _logOutput; + private PgSqlDatabaseAdapter _sut = null!; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() @@ -29,16 +26,11 @@ public void BeforeEachTest() .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); - _configuration = new AppConfiguration(); - - _sut = new PgSqlDatabaseAdapter( - PgSqlQuery.ConnectionString, - _configuration, - log.Object); + _sut = new PgSqlDatabaseAdapter(PgSqlQuery.GetConnectionString(), null!, null!, log.Object); } [Test] @@ -75,7 +67,7 @@ public void GetServerVersionSelectScript() connection.Open(); var actual = cmd.ExecuteScalar(); - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldBeOfType().ShouldNotBeNullOrWhiteSpace(); } @@ -133,8 +125,11 @@ public void SqlOutputIntoLog() [Test] public void GetSetVersionScriptDefault() { - _sut.GetVersionSelectScript().ShouldBe(PgSqlDatabaseAdapter.DefaultSelectVersion); - _sut.GetVersionUpdateScript().ShouldBe(PgSqlDatabaseAdapter.DefaultUpdateVersion); + _sut.GetCurrentVersionScript = PgSqlDefaults.DefaultSelectVersion; + _sut.SetCurrentVersionScript = PgSqlDefaults.DefaultUpdateVersion; + + _sut.GetVersionSelectScript().ShouldBe(PgSqlDefaults.DefaultSelectVersion); + _sut.GetVersionUpdateScript().ShouldBe(PgSqlDefaults.DefaultUpdateVersion); using (var connection = _sut.CreateConnection(false)) { @@ -162,8 +157,8 @@ public void GetSetVersionScriptDefault() [Test] public void GetSetVersionScriptModuleName() { - _configuration.GetCurrentVersionScript = SelectModuleVersion; - _configuration.SetCurrentVersionScript = UpdateModuleVersion; + _sut.GetCurrentVersionScript = SelectModuleVersion; + _sut.SetCurrentVersionScript = UpdateModuleVersion; _sut.GetVersionSelectScript().ShouldBe(SelectModuleVersion); _sut.GetVersionUpdateScript().ShouldBe(UpdateModuleVersion); diff --git a/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlQuery.cs b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlQuery.cs new file mode 100644 index 00000000..18213be7 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlQuery.cs @@ -0,0 +1,30 @@ +using Npgsql; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Adapter.PgSql; + +internal static class PgSqlQuery +{ + public static string GetConnectionString() + { + return ConfigurationExtensions.GetConnectionString("pgsql"); + } + + public static NpgsqlConnection Open() + { + var con = new NpgsqlConnection(GetConnectionString()); + con.Open(); + + return con; + } + + public static object? ExecuteScalar(string sql) + { + using (var connection = Open()) + using (var cmd = connection.CreateCommand()) + { + cmd.CommandText = sql; + return cmd.ExecuteScalar(); + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlTextReaderTest.cs b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlTextReaderTest.cs similarity index 90% rename from Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlTextReaderTest.cs rename to Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlTextReaderTest.cs index 6223be85..fa1e62cb 100644 --- a/Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlTextReaderTest.cs +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlTextReaderTest.cs @@ -2,12 +2,12 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.PgSql; +namespace SqlDatabase.Adapter.PgSql; [TestFixture] public class PgSqlTextReaderTest { - private PgSqlTextReader _sut; + private PgSqlTextReader _sut = null!; [SetUp] public void BeforeEachTest() diff --git a/Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlWriterTest.cs b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlWriterTest.cs similarity index 90% rename from Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlWriterTest.cs rename to Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlWriterTest.cs index b2843eb8..7e4bacfa 100644 --- a/Sources/SqlDatabase.Test/Scripts/PgSql/PgSqlWriterTest.cs +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/PgSqlWriterTest.cs @@ -9,13 +9,13 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.PgSql; +namespace SqlDatabase.Adapter.PgSql; [TestFixture] public class PgSqlWriterTest { - private StringBuilder _output; - private PgSqlWriter _sut; + private StringBuilder _output = null!; + private PgSqlWriter _sut = null!; [SetUp] public void BeforeEachTest() @@ -27,7 +27,7 @@ public void BeforeEachTest() [TearDown] public void AfterEachTest() { - Console.WriteLine(_output); + TestOutput.WriteLine(_output); } [Test] @@ -129,7 +129,7 @@ public void ValueTsVector(string value) [TestCase("fat & (rat | cat)")] public void ValueTsQuery(string value) { - var expected = PgSqlQuery.ExecuteScalar("SELECT '{0}'::tsquery".FormatWith(value)).ShouldBeAssignableTo(); + var expected = PgSqlQuery.ExecuteScalar($"SELECT '{value}'::tsquery").ShouldBeAssignableTo(); _sut .Text("SELECT ") @@ -137,7 +137,7 @@ public void ValueTsQuery(string value) .Text("::tsquery"); var actual = PgSqlQuery.ExecuteScalar(_output.ToString()).ShouldBeAssignableTo(); - actual.ToString().ShouldBe(expected.ToString()); + actual!.ToString().ShouldBe(expected!.ToString()); } [Test] @@ -177,7 +177,7 @@ public void Value2dArray(string type, object value11, object value12, object val [Test] public void ValueCompositeType() { - IDictionary expected = new ExpandoObject(); + IDictionary expected = new ExpandoObject(); expected.Add("name", "fuzzy dice"); expected.Add("supplier_id", 42); expected.Add("price", 1.99); @@ -187,7 +187,7 @@ public void ValueCompositeType() .Value(expected) .Text("::public.inventory_item"); - IDictionary actual = PgSqlQuery.ExecuteScalar(_output.ToString()).ShouldBeOfType(); + IDictionary actual = PgSqlQuery.ExecuteScalar(_output.ToString()).ShouldBeOfType(); actual.Keys.ShouldBe(expected.Keys); foreach (var key in actual.Keys) { diff --git a/Sources/SqlDatabase.Adapter.PgSql.Test/SqlDatabase.Adapter.PgSql.Test.csproj b/Sources/SqlDatabase.Adapter.PgSql.Test/SqlDatabase.Adapter.PgSql.Test.csproj new file mode 100644 index 00000000..797873bc --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/SqlDatabase.Adapter.PgSql.Test.csproj @@ -0,0 +1,19 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Adapter.PgSql + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/Scripts/PgSql/TextScriptOutputPgSqlTest.cs b/Sources/SqlDatabase.Adapter.PgSql.Test/TextScriptOutputPgSqlTest.cs similarity index 68% rename from Sources/SqlDatabase.Test/Scripts/PgSql/TextScriptOutputPgSqlTest.cs rename to Sources/SqlDatabase.Adapter.PgSql.Test/TextScriptOutputPgSqlTest.cs index 9f78b194..051bb098 100644 --- a/Sources/SqlDatabase.Test/Scripts/PgSql/TextScriptOutputPgSqlTest.cs +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/TextScriptOutputPgSqlTest.cs @@ -4,44 +4,39 @@ using Npgsql; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter.Sql; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.PgSql; +namespace SqlDatabase.Adapter.PgSql; [TestFixture] public class TextScriptOutputPgSqlTest { - private NpgsqlConnection _connection; - private NpgsqlCommand _command; - private Mock _logger; - private Variables _variables; - private TextScript _sut; + private NpgsqlConnection _connection = null!; + private NpgsqlCommand _command = null!; + private Mock _logger = null!; + private Mock _variables = null!; - private IList _logOutput; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() { - _variables = new Variables(); + _variables = new Mock(MockBehavior.Strict); _logOutput = new List(); _logger = new Mock(MockBehavior.Strict); _logger .Setup(l => l.Indent()) - .Returns((IDisposable)null); + .Returns((IDisposable)null!); _logger .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); - _sut = new TextScript - { - TextReader = new PgSqlTextReader() - }; - _connection = PgSqlQuery.Open(); _command = _connection.CreateCommand(); } @@ -56,9 +51,9 @@ public void AfterEachTest() [Test] public void ExecuteEmpty() { - _sut.ReadSqlContent = "/* do nothing */".AsFuncStream(); + var sut = CreateSut("/* do nothing */"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.ShouldBeEmpty(); } @@ -66,7 +61,7 @@ public void ExecuteEmpty() [Test] public void ExecuteDdlWithReader() { - _sut.ReadSqlContent = @" + var sut = CreateSut(@" create table public.TextScriptIntegrationTest(id int, name varchar(20)); insert into public.TextScriptIntegrationTest values(1, 'name 1'); @@ -74,10 +69,9 @@ public void ExecuteDdlWithReader() select * from public.TextScriptIntegrationTest; -drop table public.TextScriptIntegrationTest;" - .AsFuncStream(); +drop table public.TextScriptIntegrationTest;"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(8); _logOutput[0].ShouldBe("output: id; name"); @@ -93,9 +87,9 @@ public void ExecuteDdlWithReader() [Test] public void NoColumnName() { - _sut.ReadSqlContent = "select 1".AsFuncStream(); + var sut = CreateSut("select 1"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(4); _logOutput[0].ShouldBe("output: (no name)"); @@ -107,9 +101,9 @@ public void NoColumnName() [Test] public void SelectNull() { - _sut.ReadSqlContent = "select null".AsFuncStream(); + var sut = CreateSut("select null"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(4); _logOutput[0].ShouldBe("output: (no name)"); @@ -121,12 +115,11 @@ public void SelectNull() [Test] public void TwoSelections() { - _sut.ReadSqlContent = @" + var sut = CreateSut(@" select 1 first_; -select 2 second_;" - .AsFuncStream(); +select 2 second_;"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(9); @@ -146,12 +139,18 @@ public void TwoSelections() [Test] public void SelectZeroRowsNull() { - _sut.ReadSqlContent = "select null value_ limit 0".AsFuncStream(); + var sut = CreateSut("select null value_ limit 0"); - _sut.Execute(_command, _variables, _logger.Object); + sut.Execute(_command, _variables.Object, _logger.Object); _logOutput.Count.ShouldBe(2); _logOutput[0].ShouldBe("output: value_"); _logOutput[1].ShouldBe("0 rows selected"); } + + private IScript CreateSut(string sql) + { + var file = FileFactory.File("dummy.sql", sql); + return new TextScriptFactory(new PgSqlTextReader()).FromFile(file); + } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PgSql.Test/app.config b/Sources/SqlDatabase.Adapter.PgSql.Test/app.config new file mode 100644 index 00000000..022d7611 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PgSql.Test/app.config @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/PgSql/PgSqlDatabaseAdapter.cs b/Sources/SqlDatabase.Adapter.PgSql/PgSqlDatabaseAdapter.cs similarity index 53% rename from Sources/SqlDatabase/Scripts/PgSql/PgSqlDatabaseAdapter.cs rename to Sources/SqlDatabase.Adapter.PgSql/PgSqlDatabaseAdapter.cs index 10243fb5..a82d4ca8 100644 --- a/Sources/SqlDatabase/Scripts/PgSql/PgSqlDatabaseAdapter.cs +++ b/Sources/SqlDatabase.Adapter.PgSql/PgSqlDatabaseAdapter.cs @@ -1,28 +1,24 @@ using System.Data; using System.IO; using Npgsql; -using SqlDatabase.Configuration; -using SqlDatabase.Export; -namespace SqlDatabase.Scripts.PgSql; +namespace SqlDatabase.Adapter.PgSql; internal sealed class PgSqlDatabaseAdapter : IDatabaseAdapter { - public const string DefaultSelectVersion = "SELECT version FROM public.version WHERE module_name = 'database'"; - public const string DefaultUpdateVersion = "UPDATE public.version SET version='{{TargetVersion}}' WHERE module_name = 'database'"; - private readonly string _connectionString; private readonly string _connectionStringMaster; - private readonly AppConfiguration _configuration; private readonly ILogger _log; private readonly NoticeEventHandler _onConnectionNotice; public PgSqlDatabaseAdapter( string connectionString, - AppConfiguration configuration, + string getCurrentVersionScript, + string setCurrentVersionScript, ILogger log) { - _configuration = configuration; + GetCurrentVersionScript = getCurrentVersionScript; + SetCurrentVersionScript = setCurrentVersionScript; _log = log; var builder = new NpgsqlConnectionStringBuilder(connectionString) @@ -42,10 +38,14 @@ public PgSqlDatabaseAdapter( public string DatabaseName { get; } + public string GetCurrentVersionScript { get; internal set; } + + public string SetCurrentVersionScript { get; internal set; } + public string GetUserFriendlyConnectionString() { var cs = new NpgsqlConnectionStringBuilder(_connectionString); - return "database [{0}] on [{1}]".FormatWith(cs.Database, cs.Host); + return $"database [{cs.Database}] on [{cs.Host}]"; } public ISqlTextReader CreateSqlTextReader() => new PgSqlTextReader(); @@ -64,42 +64,14 @@ public IDbConnection CreateConnection(bool switchToMaster) public string GetServerVersionSelectScript() => "SELECT version();"; - public string GetDatabaseExistsScript(string databaseName) => "SELECT 1 FROM PG_DATABASE WHERE LOWER(DATNAME) = LOWER('{0}')".FormatWith(databaseName); - - public string GetVersionSelectScript() - { - var script = _configuration.PgSql.GetCurrentVersionScript; - if (string.IsNullOrWhiteSpace(script)) - { - script = _configuration.GetCurrentVersionScript; - } + public string GetDatabaseExistsScript(string databaseName) => $"SELECT 1 FROM PG_DATABASE WHERE LOWER(DATNAME) = LOWER('{databaseName}')"; - if (string.IsNullOrWhiteSpace(script)) - { - script = DefaultSelectVersion; - } + public string GetVersionSelectScript() => GetCurrentVersionScript; - return script; - } - - public string GetVersionUpdateScript() - { - var script = _configuration.PgSql.SetCurrentVersionScript; - if (string.IsNullOrWhiteSpace(script)) - { - script = _configuration.SetCurrentVersionScript; - } - - if (string.IsNullOrWhiteSpace(script)) - { - script = DefaultUpdateVersion; - } - - return script; - } + public string GetVersionUpdateScript() => SetCurrentVersionScript; private void OnConnectionNotice(object sender, NpgsqlNoticeEventArgs e) { - _log.Info("{0}: {1}".FormatWith(e.Notice.Severity, e.Notice.MessageText)); + _log.Info($"{e.Notice.Severity}: {e.Notice.MessageText}"); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PgSql/PgSqlDatabaseAdapterFactory.cs b/Sources/SqlDatabase.Adapter.PgSql/PgSqlDatabaseAdapterFactory.cs new file mode 100644 index 00000000..15d85c2b --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PgSql/PgSqlDatabaseAdapterFactory.cs @@ -0,0 +1,51 @@ +using System; +using System.Data.Common; +using Npgsql; + +namespace SqlDatabase.Adapter.PgSql; + +public static class PgSqlDatabaseAdapterFactory +{ + public static bool CanBe(string connectionString) + { + if (!IsPgSql(connectionString)) + { + return false; + } + + var builder = new DbConnectionStringBuilder(false) { ConnectionString = connectionString }; + return builder.ContainsKey("Host") && builder.ContainsKey("Database"); + } + + public static IDatabaseAdapter CreateAdapter( + string connectionString, + string? getCurrentVersionScript, + string? setCurrentVersionScript, + ILogger log) + { + return new PgSqlDatabaseAdapter( + connectionString, + string.IsNullOrWhiteSpace(getCurrentVersionScript) ? PgSqlDefaults.DefaultSelectVersion : getCurrentVersionScript!, + string.IsNullOrWhiteSpace(setCurrentVersionScript) ? PgSqlDefaults.DefaultUpdateVersion : setCurrentVersionScript!, + log); + } + + private static bool IsPgSql(string connectionString) + { + var builder = new NpgsqlConnectionStringBuilder(); + + try + { + builder.ConnectionString = connectionString; + return true; + } + catch (ArgumentException) + { + return false; + } + catch (FormatException) + { + return false; + } + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PgSql/PgSqlDefaults.cs b/Sources/SqlDatabase.Adapter.PgSql/PgSqlDefaults.cs new file mode 100644 index 00000000..41f07f9f --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PgSql/PgSqlDefaults.cs @@ -0,0 +1,7 @@ +namespace SqlDatabase.Adapter.PgSql; + +internal static class PgSqlDefaults +{ + public const string DefaultSelectVersion = "SELECT version FROM public.version WHERE module_name = 'database'"; + public const string DefaultUpdateVersion = "UPDATE public.version SET version='{{TargetVersion}}' WHERE module_name = 'database'"; +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/PgSql/PgSqlTextReader.cs b/Sources/SqlDatabase.Adapter.PgSql/PgSqlTextReader.cs similarity index 90% rename from Sources/SqlDatabase/Scripts/PgSql/PgSqlTextReader.cs rename to Sources/SqlDatabase.Adapter.PgSql/PgSqlTextReader.cs index cb06f215..ffd84fee 100644 --- a/Sources/SqlDatabase/Scripts/PgSql/PgSqlTextReader.cs +++ b/Sources/SqlDatabase.Adapter.PgSql/PgSqlTextReader.cs @@ -4,20 +4,20 @@ using System.Text; using System.Text.RegularExpressions; -namespace SqlDatabase.Scripts.PgSql; +namespace SqlDatabase.Adapter.PgSql; internal sealed class PgSqlTextReader : ISqlTextReader { private const int MaxFirstBatchSize = 20; private readonly Regex _semicolonRegex = new Regex("^(\\s*;+\\s*)+$", RegexOptions.Compiled | RegexOptions.IgnoreCase); - public string ReadFirstBatch(Stream sql) + public string? ReadFirstBatch(Stream sql) { var script = new StringBuilder(); using (var reader = new StreamReader(sql)) { - string line; + string? line; var lineNumber = 0; while ((line = reader.ReadLine()) != null) { @@ -54,7 +54,7 @@ public IEnumerable ReadBatches(Stream sql) if (string.IsNullOrWhiteSpace(script)) { - return new string[0]; + return Array.Empty(); } return new[] { script }; diff --git a/Sources/SqlDatabase/Scripts/PgSql/PgSqlWriter.cs b/Sources/SqlDatabase.Adapter.PgSql/PgSqlWriter.cs similarity index 94% rename from Sources/SqlDatabase/Scripts/PgSql/PgSqlWriter.cs rename to Sources/SqlDatabase.Adapter.PgSql/PgSqlWriter.cs index 838ce2ef..43c4e283 100644 --- a/Sources/SqlDatabase/Scripts/PgSql/PgSqlWriter.cs +++ b/Sources/SqlDatabase.Adapter.PgSql/PgSqlWriter.cs @@ -9,9 +9,8 @@ using System.Reflection; using System.Text; using NpgsqlTypes; -using SqlDatabase.Export; -namespace SqlDatabase.Scripts.PgSql; +namespace SqlDatabase.Adapter.PgSql; internal sealed class PgSqlWriter : SqlWriterBase { @@ -35,7 +34,7 @@ public override SqlWriterBase BatchSeparator() public override SqlWriterBase DataType(string typeName, int size, int precision, int scale) { var name = typeName.ToUpperInvariant(); - string sizeText = null; + string? sizeText = null; switch (name) { @@ -49,7 +48,7 @@ public override SqlWriterBase DataType(string typeName, int size, int precision, case "TIME": if (scale != 0) { - sizeText = "{0},{1}".FormatWith(precision, scale); + sizeText = $"{precision},{scale}"; } else if (precision != 0) { @@ -81,7 +80,7 @@ public override SqlWriterBase DataType(string typeName, int size, int precision, public override ExportTable ReadSchemaTable(DataTable metadata, string tableName) { - var result = new ExportTable { Name = tableName }; + var result = new ExportTable(tableName); const string GeneratedName = "GeneratedName"; var generatedIndex = 0; @@ -115,7 +114,7 @@ public override ExportTable ReadSchemaTable(DataTable metadata, string tableName public override string GetDefaultTableName() => "public.sqldatabase_export"; - protected override bool TryWriteValue(object value, string typeNameHint) + protected override bool TryWriteValue(object value, string? typeNameHint) { var type = value.GetType(); @@ -223,7 +222,7 @@ protected override bool TryWriteValue(object value, string typeNameHint) return true; } - throw new NotSupportedException("{0}d array is not supported.".FormatWith(array.Rank)); + throw new NotSupportedException($"{array.Rank}d array is not supported."); } if (value is ExpandoObject composite) @@ -235,7 +234,7 @@ protected override bool TryWriteValue(object value, string typeNameHint) if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(NpgsqlRange<>)) { GetType() - .GetMethod(nameof(ValueRange), BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly) + .GetMethod(nameof(ValueRange), BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)! .MakeGenericMethod(type.GenericTypeArguments) .Invoke(this, new[] { value }); return true; @@ -389,7 +388,7 @@ private void CollectLexeme(NpgsqlTsQuery value, IDictionary value) + private void ValueComposite(IDictionary value) { Output.Write("ROW("); diff --git a/Sources/SqlDatabase.Adapter.PgSql/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Adapter.PgSql/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..717827ba --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PgSql/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.Adapter.PgSql.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PgSql/SqlDatabase.Adapter.PgSql.csproj b/Sources/SqlDatabase.Adapter.PgSql/SqlDatabase.Adapter.PgSql.csproj new file mode 100644 index 00000000..75604752 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PgSql/SqlDatabase.Adapter.PgSql.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/DiagnosticsToolsTest.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/DiagnosticsToolsTest.cs similarity index 94% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/DiagnosticsToolsTest.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/DiagnosticsToolsTest.cs index 228ca6e3..bc4bbf79 100644 --- a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/DiagnosticsToolsTest.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/DiagnosticsToolsTest.cs @@ -4,7 +4,7 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; [TestFixture] public class DiagnosticsToolsTest diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/InstallationSeekerTest.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/InstallationSeekerTest.cs similarity index 92% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/InstallationSeekerTest.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/InstallationSeekerTest.cs index 58351bb4..99329240 100644 --- a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/InstallationSeekerTest.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/InstallationSeekerTest.cs @@ -1,13 +1,13 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using Moq; using NUnit.Framework; using Shouldly; using SqlDatabase.TestApi; -using InstallationInfo = SqlDatabase.Scripts.PowerShellInternal.InstallationSeeker.InstallationInfo; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; [TestFixture] public class InstallationSeekerTest @@ -18,7 +18,7 @@ public void TryFindByParentProcess() var actual = InstallationSeeker.TryFindByParentProcess(out var path); if (actual) { - Console.WriteLine(path); + TestOutput.WriteLine(path); } } @@ -31,7 +31,7 @@ public void TryFindOnDisk() InstallationSeeker.TryFindOnDisk(out var path).ShouldBeTrue(); - Console.WriteLine(path); + TestOutput.WriteLine(path); } [Test] @@ -55,7 +55,7 @@ public void TryGetInfo() actual.Location.ShouldBe(dir.Location); actual.Version.ShouldBe(GetType().Assembly.GetName().Version); - actual.ProductVersion.ShouldBe(actual.Version.ToString()); + actual.ProductVersion.ShouldBe(GetType().Assembly.GetCustomAttribute()!.InformationalVersion); } } diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellScriptFactoryTest.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellScriptFactoryTest.cs new file mode 100644 index 00000000..aae7b12b --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellScriptFactoryTest.cs @@ -0,0 +1,52 @@ +using System.IO; +using Moq; +using NUnit.Framework; +using Shouldly; +using SqlDatabase.FileSystem; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Adapter.PowerShellScripts; + +[TestFixture] +public class PowerShellScriptFactoryTest +{ + private Mock _powerShell = null!; + private PowerShellScriptFactory _sut = null!; + + [SetUp] + public void BeforeEachTest() + { + _powerShell = new Mock(MockBehavior.Strict); + _sut = new PowerShellScriptFactory(_powerShell.Object); + } + + [Test] + [TestCase(".Ps1", true)] + [TestCase(".sql", false)] + [TestCase(null, false)] + public void IsSupported(string? ext, bool expected) + { + var file = new Mock(MockBehavior.Strict); + file + .SetupGet(f => f.Extension) + .Returns(ext!); + + _sut.IsSupported(file.Object).ShouldBe(expected); + } + + [Test] + public void FromFile() + { + var file = FileFactory.File( + "11.ps1", + "some script", + FileFactory.Folder("name", FileFactory.File("11.txt", "3, 2, 1"))); + + var script = _sut.FromFile(file).ShouldBeOfType(); + + script.DisplayName.ShouldBe("11.ps1"); + script.PowerShellFactory.ShouldBe(_powerShell.Object); + new StreamReader(script.ReadScriptContent()).ReadToEnd().ShouldBe("some script"); + new StreamReader(script.ReadDescriptionContent()!).ReadToEnd().ShouldBe("3, 2, 1"); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellScriptTest.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellScriptTest.cs similarity index 77% rename from Sources/SqlDatabase.Test/Scripts/PowerShellScriptTest.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellScriptTest.cs index df954346..f69fa0b8 100644 --- a/Sources/SqlDatabase.Test/Scripts/PowerShellScriptTest.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellScriptTest.cs @@ -1,23 +1,21 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using System.IO; using System.Text; using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Scripts.PowerShellInternal; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter.PowerShellScripts; [TestFixture] public class PowerShellScriptTest { - private PowerShellScript _sut; - private Mock _powerShell; - private Mock _variables; - private Mock _command; - private Mock _log; + private PowerShellScript _sut = null!; + private Mock _powerShell = null!; + private Mock _variables = null!; + private Mock _command = null!; + private Mock _log = null!; [SetUp] public void BeforeEachTest() @@ -32,17 +30,14 @@ public void BeforeEachTest() .Setup(f => f.Create()) .Returns(_powerShell.Object); - _sut = new PowerShellScript - { - PowerShellFactory = factory.Object - }; + _sut = new PowerShellScript(null!, null!, null!, factory.Object); } [Test] public void Execute() { _powerShell - .Setup(p => p.Invoke("script content", _log.Object, It.IsNotNull[]>())) + .Setup(p => p.Invoke("script content", _log.Object, It.IsNotNull[]>())) .Callback[]>((_, _, parameters) => { parameters.Length.ShouldBe(2); @@ -66,7 +61,7 @@ public void ExecuteWhatIf() .Setup(p => p.SupportsShouldProcess("script content")) .Returns(true); _powerShell - .Setup(p => p.Invoke("script content", _log.Object, It.IsNotNull[]>())) + .Setup(p => p.Invoke("script content", _log.Object, It.IsNotNull[]>())) .Callback[]>((_, _, parameters) => { parameters.Length.ShouldBe(3); @@ -105,19 +100,12 @@ public void ExecuteIgnoreWhatIf() [Test] public void GetDependencies() { - var description = Encoding.Default.GetBytes(@" --- module dependency: a 1.0 --- module dependency: b 1.0"); - - _sut.ReadDescriptionContent = () => new MemoryStream(description); + _sut.ReadDescriptionContent = () => new MemoryStream(Encoding.Default.GetBytes("dependencies")); var actual = _sut.GetDependencies(); - actual.ShouldBe(new[] - { - new ScriptDependency("a", new Version("1.0")), - new ScriptDependency("b", new Version("1.0")) - }); + actual.ShouldNotBeNull(); + actual.ReadToEnd().ShouldBe("dependencies"); } [Test] @@ -127,6 +115,6 @@ public void GetDependenciesNoDescription() var actual = _sut.GetDependencies(); - actual.ShouldBeEmpty(); + actual.ShouldBeNull(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.ExecuteWhatIfIgnore.ps1 b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.ExecuteWhatIfIgnore.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.ExecuteWhatIfIgnore.ps1 rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.ExecuteWhatIfIgnore.ps1 diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.ExecuteWhatIfInvoke.ps1 b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.ExecuteWhatIfInvoke.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.ExecuteWhatIfInvoke.ps1 rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.ExecuteWhatIfInvoke.ps1 diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.HandleOutput.ps1 b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.HandleOutput.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.HandleOutput.ps1 rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.HandleOutput.ps1 diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.HandleThrow.ps1 b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.HandleThrow.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.HandleThrow.ps1 rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.HandleThrow.ps1 diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.HandleWriteError.ps1 b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.HandleWriteError.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.HandleWriteError.ps1 rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.HandleWriteError.ps1 diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.ParametersBinding.ps1 b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.ParametersBinding.ps1 similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.ParametersBinding.ps1 rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.ParametersBinding.ps1 diff --git a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.cs similarity index 81% rename from Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.cs index 1043bf25..f81d5e89 100644 --- a/Sources/SqlDatabase.Test/Scripts/PowerShellInternal/PowerShellTest.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/PowerShellTest.cs @@ -7,17 +7,17 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; [TestFixture] public class PowerShellTest { - private IPowerShellFactory _factory; - private IPowerShell _sut; - private Mock _logger; - private Mock _variables; - private Mock _command; - private List _logOutput; + private IPowerShellFactory _factory = null!; + private IPowerShell _sut = null!; + private Mock _logger = null!; + private Mock _variables = null!; + private Mock _command = null!; + private List _logOutput = null!; [OneTimeSetUp] public void BeforeAllTests() @@ -33,9 +33,10 @@ public void BeforeAllTests() .Callback(m => _logOutput.Add("error: " + m)); _logger .Setup(l => l.Indent()) - .Returns((IDisposable)null); + .Returns((IDisposable)null!); - _factory = TestPowerShellHost.GetOrCreateFactory(); + _factory = PowerShellFactory.Create(null); + _factory.Initialize(_logger.Object); } [SetUp] @@ -54,7 +55,7 @@ public void AfterEachTest() { foreach (var line in _logOutput) { - Console.WriteLine(line); + TestOutput.WriteLine(line); } } @@ -103,7 +104,7 @@ public void HandleThrow() catch (Exception ex) { failed = true; - Console.WriteLine(ex); + TestOutput.WriteLine(ex); } failed.ShouldBeTrue(); @@ -175,12 +176,12 @@ private static string LoadScript(string name) private void InvokeExecute(string script, bool whatIf) { - var parameters = new KeyValuePair[2 + (whatIf ? 1 : 0)]; - parameters[0] = new KeyValuePair(PowerShellScript.ParameterCommand, _command.Object); - parameters[1] = new KeyValuePair(PowerShellScript.ParameterVariables, new VariablesProxy(_variables.Object)); + var parameters = new KeyValuePair[2 + (whatIf ? 1 : 0)]; + parameters[0] = new KeyValuePair(PowerShellScript.ParameterCommand, _command.Object); + parameters[1] = new KeyValuePair(PowerShellScript.ParameterVariables, new VariablesProxy(_variables.Object)); if (whatIf) { - parameters[2] = new KeyValuePair(PowerShellScript.ParameterWhatIf, null); + parameters[2] = new KeyValuePair(PowerShellScript.ParameterWhatIf, null); } _sut.Invoke(script, _logger.Object, parameters); diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/SqlDatabase.Adapter.PowerShellScripts.Test.csproj b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/SqlDatabase.Adapter.PowerShellScripts.Test.csproj new file mode 100644 index 00000000..2106e043 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts.Test/SqlDatabase.Adapter.PowerShellScripts.Test.csproj @@ -0,0 +1,22 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Adapter.PowerShellScripts + + + + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts/CodeAnalysis/AllowNullAttribute.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/CodeAnalysis/AllowNullAttribute.cs new file mode 100644 index 00000000..39be8db8 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/CodeAnalysis/AllowNullAttribute.cs @@ -0,0 +1,8 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] +internal sealed class AllowNullAttribute : Attribute +{ +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts/CodeAnalysis/NotNullWhenAttribute.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/CodeAnalysis/NotNullWhenAttribute.cs new file mode 100644 index 00000000..e3d56cf7 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/CodeAnalysis/NotNullWhenAttribute.cs @@ -0,0 +1,10 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +internal sealed class NotNullWhenAttribute : Attribute +{ + public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; + + public bool ReturnValue { get; } +} +#endif diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/DiagnosticsTools.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/DiagnosticsTools.cs similarity index 94% rename from Sources/SqlDatabase/Scripts/PowerShellInternal/DiagnosticsTools.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/DiagnosticsTools.cs index dac673bc..269719e7 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/DiagnosticsTools.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/DiagnosticsTools.cs @@ -3,14 +3,14 @@ using System.IO; using System.Runtime.InteropServices; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; internal static class DiagnosticsTools { public static bool IsOSPlatformWindows() { -#if NET452 - return true; +#if NET472 + return true; #else return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); #endif @@ -18,8 +18,8 @@ public static bool IsOSPlatformWindows() public static int? GetParentProcessId(int processId) { -#if NET452 - return null; +#if NET472 + return null; #else return IsOSPlatformWindows() ? GetParentProcessIdWindows(processId) : GetParentProcessIdLinux(processId); #endif @@ -27,7 +27,7 @@ public static bool IsOSPlatformWindows() internal static int? ParseParentProcessIdLinux(string fileName) { - string line = null; + string? line = null; try { @@ -47,7 +47,7 @@ public static bool IsOSPlatformWindows() } // (2) comm %s: The filename of the executable, in parentheses. - var startIndex = line.LastIndexOf(')'); + var startIndex = line!.LastIndexOf(')'); if (startIndex <= 0 || startIndex >= line.Length) { return null; @@ -82,7 +82,7 @@ public static bool IsOSPlatformWindows() return null; } -#if !NET452 +#if !NET472 private static int? GetParentProcessIdLinux(int processId) { // /proc/[pid]/stat https://man7.org/linux/man-pages/man5/procfs.5.html diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/IPowerShell.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/IPowerShell.cs similarity index 68% rename from Sources/SqlDatabase/Scripts/PowerShellInternal/IPowerShell.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/IPowerShell.cs index 4de3ab45..0f3bd82a 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/IPowerShell.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/IPowerShell.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; internal interface IPowerShell { bool SupportsShouldProcess(string script); - void Invoke(string script, ILogger logger, params KeyValuePair[] parameters); + void Invoke(string script, ILogger logger, params KeyValuePair[] parameters); } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts/IPowerShellFactory.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/IPowerShellFactory.cs new file mode 100644 index 00000000..c9ffe25e --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/IPowerShellFactory.cs @@ -0,0 +1,8 @@ +namespace SqlDatabase.Adapter.PowerShellScripts; + +internal interface IPowerShellFactory +{ + void Initialize(ILogger logger); + + IPowerShell Create(); +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts/InstallationInfo.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/InstallationInfo.cs new file mode 100644 index 00000000..b81c8cc0 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/InstallationInfo.cs @@ -0,0 +1,55 @@ +using System; +using System.Diagnostics; + +namespace SqlDatabase.Adapter.PowerShellScripts; + +[DebuggerDisplay("{Version}")] +internal readonly struct InstallationInfo : IComparable +{ + public InstallationInfo(string location, Version version, string productVersion) + { + Location = location; + Version = version; + ProductVersion = productVersion ?? string.Empty; + } + + public string Location { get; } + + public Version Version { get; } + + public string ProductVersion { get; } + + public int CompareTo(InstallationInfo other) + { + var result = Version.CompareTo(other.Version); + if (result != 0) + { + return result; + } + + var isPreview = IsPreview(); + var otherIsPreview = other.IsPreview(); + if (isPreview && !otherIsPreview) + { + return -1; + } + + if (!isPreview && otherIsPreview) + { + return 1; + } + + result = StringComparer.InvariantCultureIgnoreCase.Compare(ProductVersion, other.ProductVersion); + if (result == 0) + { + result = StringComparer.InvariantCultureIgnoreCase.Compare(Location, other.Location); + } + + return result; + } + + private bool IsPreview() + { + return ProductVersion.IndexOf("preview", StringComparison.OrdinalIgnoreCase) > 0; + } +} diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/InstallationSeeker.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/InstallationSeeker.cs similarity index 67% rename from Sources/SqlDatabase/Scripts/PowerShellInternal/InstallationSeeker.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/InstallationSeeker.cs index 65792f8b..989409f3 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/InstallationSeeker.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/InstallationSeeker.cs @@ -1,16 +1,17 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; internal static class InstallationSeeker { public const string RootAssemblyName = "System.Management.Automation"; public const string RootAssemblyFileName = RootAssemblyName + ".dll"; - public static bool TryFindByParentProcess(out string installationPath) + public static bool TryFindByParentProcess([NotNullWhen(true)] out string? installationPath) { int processId; DateTime processStartTime; @@ -22,11 +23,11 @@ public static bool TryFindByParentProcess(out string installationPath) installationPath = FindPowerShellProcess(processId, processStartTime); return !string.IsNullOrEmpty(installationPath) - && TryGetInfo(installationPath, out var info) + && TryGetInfo(installationPath!, out var info) && IsCompatibleVersion(info.Version); } - public static bool TryFindOnDisk(out string installationPath) + public static bool TryFindOnDisk([NotNullWhen(true)] out string? installationPath) { installationPath = null; var root = GetDefaultInstallationRoot(); @@ -80,7 +81,7 @@ public static bool TryGetInfo(string installationPath, out InstallationInfo info return true; } - private static string FindPowerShellProcess(int processId, DateTime processStartTime) + private static string? FindPowerShellProcess(int processId, DateTime processStartTime) { var parentId = DiagnosticsTools.GetParentProcessId(processId); if (!parentId.HasValue || parentId == processId) @@ -88,7 +89,7 @@ private static string FindPowerShellProcess(int processId, DateTime processStart return null; } - string parentLocation = null; + string? parentLocation = null; try { using (var parent = Process.GetProcessById(parentId.Value)) @@ -130,7 +131,9 @@ private static string GetDefaultInstallationRoot() private static bool IsCompatibleVersion(Version version) { -#if NET7_0 +#if NET8_0 + return version < new Version("7.5"); +#elif NET7_0 return version < new Version("7.4"); #elif NET6_0 return version < new Version("7.3"); @@ -142,55 +145,4 @@ private static bool IsCompatibleVersion(Version version) return false; #endif } - - [DebuggerDisplay("{Version}")] - internal readonly struct InstallationInfo : IComparable - { - public InstallationInfo(string location, Version version, string productVersion) - { - Location = location; - Version = version; - ProductVersion = productVersion ?? string.Empty; - } - - public string Location { get; } - - public Version Version { get; } - - public string ProductVersion { get; } - - public int CompareTo(InstallationInfo other) - { - var result = Version.CompareTo(other.Version); - if (result != 0) - { - return result; - } - - var isPreview = IsPreview(); - var otherIsPreview = other.IsPreview(); - if (isPreview && !otherIsPreview) - { - return -1; - } - - if (!isPreview && otherIsPreview) - { - return 1; - } - - result = StringComparer.InvariantCultureIgnoreCase.Compare(ProductVersion, other.ProductVersion); - if (result == 0) - { - result = StringComparer.InvariantCultureIgnoreCase.Compare(Location, other.Location); - } - - return result; - } - - private bool IsPreview() - { - return ProductVersion.IndexOf("preview", StringComparison.OrdinalIgnoreCase) > 0; - } - } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShell.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShell.cs similarity index 95% rename from Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShell.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShell.cs index 0c00d4e0..f7885734 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShell.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShell.cs @@ -3,7 +3,7 @@ using System.Management.Automation; using System.Management.Automation.Runspaces; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; internal sealed class PowerShell : IPowerShell { @@ -21,7 +21,7 @@ public bool SupportsShouldProcess(string script) return false; } - public void Invoke(string script, ILogger logger, params KeyValuePair[] parameters) + public void Invoke(string script, ILogger logger, params KeyValuePair[] parameters) { var sessionState = InitialSessionState.CreateDefault(); using (var runSpace = RunspaceFactory.CreateRunspace(sessionState)) diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.cs similarity index 50% rename from Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.cs index eb39a55e..3d9761ce 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.cs @@ -1,40 +1,26 @@ using System; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; internal sealed partial class PowerShellFactory : IPowerShellFactory { - private bool _requested; private bool _initialized; - private PowerShellFactory(string installationPath) + private PowerShellFactory(string? installationPath) { InstallationPath = installationPath; } - public string InstallationPath { get; private set; } + public string? InstallationPath { get; private set; } - // only for tests - internal static IPowerShellFactory SharedTestFactory { get; set; } - - public static IPowerShellFactory Create(string installationPath) + public static IPowerShellFactory Create(string? installationPath) { - if (SharedTestFactory != null) - { - return SharedTestFactory; - } - return new PowerShellFactory(installationPath); } - public void Request() - { - _requested = true; - } - - public void InitializeIfRequested(ILogger logger) + public void Initialize(ILogger logger) { - if (_initialized || !_requested) + if (_initialized) { return; } diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.hosted.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.hosted.cs new file mode 100644 index 00000000..ef3d7c27 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.hosted.cs @@ -0,0 +1,106 @@ +#if NET5_0_OR_GREATER +using System; +using System.IO; +using System.Management.Automation; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.Loader; + +namespace SqlDatabase.Adapter.PowerShellScripts; + +// https://github.com/PowerShell/PowerShell/tree/master/docs/host-powershell +internal partial class PowerShellFactory +{ + private static string? _initializedInstallationPath; + + partial void DoInitialize(ILogger logger) + { + if (string.IsNullOrEmpty(InstallationPath)) + { + if (InstallationSeeker.TryFindByParentProcess(out var test)) + { + InstallationPath = test; + } + else if (InstallationSeeker.TryFindOnDisk(out test)) + { + InstallationPath = test; + } + } + + if (string.IsNullOrEmpty(InstallationPath)) + { + throw new InvalidOperationException("PowerShell Core installation not found, please provide installation path via command line options -usePowerShell."); + } + + if (!InstallationSeeker.TryGetInfo(InstallationPath, out var info)) + { + throw new InvalidOperationException($"PowerShell Core installation not found in {InstallationPath}."); + } + + logger.Info($"host PowerShell from {InstallationPath}, version {info.ProductVersion}"); + + AssemblyLoadContext.Default.Resolving += AssemblyResolving; + try + { + Test(logger); + } + catch (Exception ex) + { + throw new InvalidOperationException("PowerShell host initialization failed. Try to use another PowerShell Core installation.", ex); + } + finally + { + AssemblyLoadContext.Default.Resolving -= AssemblyResolving; + } + } + + private void Test(ILogger logger) + { + SetPowerShellAssemblyLoadContext(); + + using (logger.Indent()) + { + const string Script = @" +Write-Host ""PSVersion:"" $PSVersionTable.PSVersion +Write-Host ""PSEdition:"" $PSVersionTable.PSEdition +Write-Host ""OS:"" $PSVersionTable.OS"; + + Create().Invoke(Script, logger); + } + } + + private Assembly? AssemblyResolving(AssemblyLoadContext context, AssemblyName assemblyName) + { + if (InstallationSeeker.RootAssemblyName.Equals(assemblyName.Name, StringComparison.OrdinalIgnoreCase)) + { + var fileName = Path.Combine(InstallationPath!, InstallationSeeker.RootAssemblyFileName); + return context.LoadFromAssemblyPath(fileName); + } + + // https://github.com/PowerShell/PowerShell/releases/download/v7.0.5/powershell_7.0.5-1.debian.10_amd64.deb + // Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. + // package contains Microsoft.Management.Infrastructure, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null + if ("Microsoft.Management.Infrastructure".Equals(assemblyName.Name, StringComparison.OrdinalIgnoreCase)) + { + var fileName = Path.Combine(InstallationPath!, assemblyName.Name + ".dll"); + if (File.Exists(fileName)) + { + return context.LoadFromAssemblyPath(fileName); + } + } + + return null; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private void SetPowerShellAssemblyLoadContext() + { + // The singleton of PowerShellAssemblyLoadContext has already been initialized + if (_initializedInstallationPath == null || !_initializedInstallationPath.Equals(InstallationPath, StringComparison.OrdinalIgnoreCase)) + { + PowerShellAssemblyLoadContextInitializer.SetPowerShellAssemblyLoadContext(InstallationPath); + _initializedInstallationPath = InstallationPath; + } + } +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.native.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.native.cs new file mode 100644 index 00000000..8f2bb9fe --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellFactory.native.cs @@ -0,0 +1,7 @@ +#if NET472 || NETSTANDARD +namespace SqlDatabase.Adapter.PowerShellScripts; + +internal partial class PowerShellFactory +{ +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/PowerShellScript.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellScript.cs similarity index 54% rename from Sources/SqlDatabase/Scripts/PowerShellScript.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellScript.cs index dc9274b3..b42800ec 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellScript.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellScript.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using System.Data; using System.IO; -using System.Linq; -using SqlDatabase.Scripts.PowerShellInternal; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter.PowerShellScripts; internal sealed class PowerShellScript : IScript { @@ -13,15 +11,27 @@ internal sealed class PowerShellScript : IScript public const string ParameterVariables = "Variables"; public const string ParameterWhatIf = "WhatIf"; + public PowerShellScript( + string displayName, + Func readScriptContent, + Func readDescriptionContent, + IPowerShellFactory powerShellFactory) + { + DisplayName = displayName; + ReadScriptContent = readScriptContent; + ReadDescriptionContent = readDescriptionContent; + PowerShellFactory = powerShellFactory; + } + public string DisplayName { get; set; } - public Func ReadScriptContent { get; set; } + public Func ReadScriptContent { get; internal set; } - public Func ReadDescriptionContent { get; set; } + public Func ReadDescriptionContent { get; internal set; } - public IPowerShellFactory PowerShellFactory { get; set; } + public IPowerShellFactory PowerShellFactory { get; } - public void Execute(IDbCommand command, IVariables variables, ILogger logger) + public void Execute(IDbCommand? command, IVariables variables, ILogger logger) { string script; using (var stream = ReadScriptContent()) @@ -46,30 +56,25 @@ public IEnumerable ExecuteReader(IDbCommand command, IVariables var throw new NotSupportedException("PowerShell script does not support readers."); } - public IList GetDependencies() + public TextReader? GetDependencies() { - using (var description = ReadDescriptionContent()) + var description = ReadDescriptionContent(); + if (description == null) { - if (description == null) - { - return new ScriptDependency[0]; - } - - using (var reader = new StreamReader(description)) - { - return DependencyParser.ExtractDependencies(reader, DisplayName).ToArray(); - } + return null; } + + return new StreamReader(description); } - private static void Invoke(IPowerShell powerShell, string script, IDbCommand command, IVariables variables, ILogger logger, bool whatIf) + private static void Invoke(IPowerShell powerShell, string script, IDbCommand? command, IVariables variables, ILogger logger, bool whatIf) { - var parameters = new KeyValuePair[2 + (whatIf ? 1 : 0)]; - parameters[0] = new KeyValuePair(ParameterCommand, command); - parameters[1] = new KeyValuePair(ParameterVariables, new VariablesProxy(variables)); + var parameters = new KeyValuePair[2 + (whatIf ? 1 : 0)]; + parameters[0] = new KeyValuePair(ParameterCommand, command); + parameters[1] = new KeyValuePair(ParameterVariables, new VariablesProxy(variables)); if (whatIf) { - parameters[2] = new KeyValuePair(ParameterWhatIf, null); + parameters[2] = new KeyValuePair(ParameterWhatIf, null); } powerShell.Invoke(script, logger, parameters); diff --git a/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellScriptFactory.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellScriptFactory.cs new file mode 100644 index 00000000..1f9cae8c --- /dev/null +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellScriptFactory.cs @@ -0,0 +1,56 @@ +using System; +using System.IO; +using System.Linq; +using SqlDatabase.FileSystem; + +namespace SqlDatabase.Adapter.PowerShellScripts; + +public sealed class PowerShellScriptFactory : IScriptFactory, IScriptEnvironment +{ + private readonly IPowerShellFactory _powerShell; + + public PowerShellScriptFactory(string? installationPath) + : this(PowerShellFactory.Create(installationPath)) + { + } + + internal PowerShellScriptFactory(IPowerShellFactory powerShell) + { + _powerShell = powerShell; + } + + public bool IsSupported(IFile file) + { + return ".ps1".Equals(file.Extension, StringComparison.OrdinalIgnoreCase); + } + + public IScript FromFile(IFile file) + { + return new PowerShellScript( + file.Name, + file.OpenRead, + CreateScriptDescriptionReader(file), + _powerShell); + } + + public bool IsSupported(IScript script) => script is PowerShellScript; + + public void Initialize(ILogger logger) => _powerShell.Initialize(logger); + + private static Func CreateScriptDescriptionReader(IFile file) + { + return () => + { + var parent = file.GetParent(); + if (parent == null) + { + return null; + } + + var descriptionName = Path.GetFileNameWithoutExtension(file.Name) + ".txt"; + var description = parent.GetFiles().FirstOrDefault(i => string.Equals(descriptionName, i.Name, StringComparison.OrdinalIgnoreCase)); + + return description?.OpenRead(); + }; + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellStreamsListener.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellStreamsListener.cs similarity index 65% rename from Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellStreamsListener.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellStreamsListener.cs index 1024b823..86b1164c 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellStreamsListener.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/PowerShellStreamsListener.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Management.Automation; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; internal sealed class PowerShellStreamsListener : IDisposable { @@ -35,10 +35,10 @@ public void Dispose() private static IList GetInformation(PSDataStreams streams) { -#if !NET452 +#if !NET472 return streams.Information; #else - return ReflectionGetInformation(streams); + return ReflectionGetInformation(streams); #endif } @@ -47,7 +47,7 @@ private static IList ReflectionGetInformation(PSDataStreams streams) return (IList)streams .GetType() .FindProperty("Information") - .GetValue(streams, null); + .GetValue(streams, null)!; } private static void InvokeDataAdded(object dataCollection, EventHandler handler, bool subscribe) @@ -58,32 +58,32 @@ private static void InvokeDataAdded(object dataCollection, EventHandler + + + net472;net6.0;net7.0;net8.0;netstandard2.0 + + + + + + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/VariablesProxy.cs b/Sources/SqlDatabase.Adapter.PowerShellScripts/VariablesProxy.cs similarity index 55% rename from Sources/SqlDatabase/Scripts/PowerShellInternal/VariablesProxy.cs rename to Sources/SqlDatabase.Adapter.PowerShellScripts/VariablesProxy.cs index e7032814..126d2d53 100644 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/VariablesProxy.cs +++ b/Sources/SqlDatabase.Adapter.PowerShellScripts/VariablesProxy.cs @@ -1,6 +1,7 @@ -using System.Dynamic; +using System.Diagnostics.CodeAnalysis; +using System.Dynamic; -namespace SqlDatabase.Scripts.PowerShellInternal; +namespace SqlDatabase.Adapter.PowerShellScripts; internal sealed class VariablesProxy : DynamicObject { @@ -11,7 +12,9 @@ public VariablesProxy(IVariables variables) _variables = variables; } - public override bool TryGetMember(GetMemberBinder binder, out object result) + public override bool TryGetMember( + GetMemberBinder binder, + [NotNullWhen(true)] out object? result) { result = _variables.GetValue(binder.Name); return result != null; diff --git a/Sources/SqlDatabase.Test/Export/DataExportLoggerTest.cs b/Sources/SqlDatabase.Adapter.Sql.Test/Export/DataExportLoggerTest.cs similarity index 87% rename from Sources/SqlDatabase.Test/Export/DataExportLoggerTest.cs rename to Sources/SqlDatabase.Adapter.Sql.Test/Export/DataExportLoggerTest.cs index ccaa66fe..9879b9fd 100644 --- a/Sources/SqlDatabase.Test/Export/DataExportLoggerTest.cs +++ b/Sources/SqlDatabase.Adapter.Sql.Test/Export/DataExportLoggerTest.cs @@ -3,13 +3,13 @@ using NUnit.Framework; using Shouldly; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter.Sql.Export; [TestFixture] public class DataExportLoggerTest { - private DataExportLogger _sut; - private IList _output; + private DataExportLogger _sut = null!; + private IList _output = null!; [SetUp] public void BeforeEachTest() diff --git a/Sources/SqlDatabase.Adapter.Sql.Test/SqlDatabase.Adapter.Sql.Test.csproj b/Sources/SqlDatabase.Adapter.Sql.Test/SqlDatabase.Adapter.Sql.Test.csproj new file mode 100644 index 00000000..67641488 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.Sql.Test/SqlDatabase.Adapter.Sql.Test.csproj @@ -0,0 +1,19 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Adapter.Sql + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/Scripts/SqlScriptVariableParserTest.cs b/Sources/SqlDatabase.Adapter.Sql.Test/SqlScriptVariableParserTest.cs similarity index 94% rename from Sources/SqlDatabase.Test/Scripts/SqlScriptVariableParserTest.cs rename to Sources/SqlDatabase.Adapter.Sql.Test/SqlScriptVariableParserTest.cs index 31f6b67e..460f74b1 100644 --- a/Sources/SqlDatabase.Test/Scripts/SqlScriptVariableParserTest.cs +++ b/Sources/SqlDatabase.Adapter.Sql.Test/SqlScriptVariableParserTest.cs @@ -3,13 +3,13 @@ using NUnit.Framework; using Shouldly; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter.Sql; [TestFixture] public class SqlScriptVariableParserTest { - private Mock _variables; - private SqlScriptVariableParser _sut; + private Mock _variables = null!; + private SqlScriptVariableParser _sut = null!; [SetUp] public void BeforeEachTest() @@ -99,11 +99,11 @@ public void ApplyVariablesFailsOnUnknownVariable() { _variables .Setup(v => v.GetValue(It.IsAny())) - .Returns((string)null); + .Returns((string?)null); var ex = Assert.Throws(() => _sut.ApplyVariables("{{Value_1}}")); - ex.Message.ShouldContain("Value_1"); + ex!.Message.ShouldContain("Value_1"); } [Test] diff --git a/Sources/SqlDatabase.Test/Scripts/TextScriptTest.cs b/Sources/SqlDatabase.Adapter.Sql.Test/TextScriptTest.cs similarity index 52% rename from Sources/SqlDatabase.Test/Scripts/TextScriptTest.cs rename to Sources/SqlDatabase.Adapter.Sql.Test/TextScriptTest.cs index 9a5a2cb3..60c0e49e 100644 --- a/Sources/SqlDatabase.Test/Scripts/TextScriptTest.cs +++ b/Sources/SqlDatabase.Adapter.Sql.Test/TextScriptTest.cs @@ -1,33 +1,36 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; -using System.Text; using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Scripts.MsSql; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter.Sql; [TestFixture] public class TextScriptTest { - private Mock _logger; - private Variables _variables; - private Mock _command; - private TextScript _sut; + private Mock _logger = null!; + private Mock _variables = null!; + private Mock _textReader = null!; + private Mock _command = null!; + private TextScript _sut = null!; - private IList _logOutput; - private IList _executedScripts; - private Mock _executedReader; + private IList _logOutput = null!; + private IList _executedScripts = null!; + private Mock _executedReader = null!; [SetUp] public void BeforeEachTest() { - _variables = new Variables(); + _variables = new Mock(MockBehavior.Strict); + _variables + .Setup(v => v.GetValue("var1")) + .Returns("[some value]"); + + _textReader = new Mock(MockBehavior.Strict); _logOutput = new List(); _logger = new Mock(MockBehavior.Strict); @@ -35,7 +38,7 @@ public void BeforeEachTest() .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); @@ -52,21 +55,21 @@ public void BeforeEachTest() .Callback(() => _executedScripts.Add(_command.Object.CommandText)) .Returns(_executedReader.Object); - _sut = new TextScript - { - TextReader = new MsSqlTextReader() - }; - _variables.SetValue(VariableSource.CommandLine, "var1", "[some value]"); + _sut = new TextScript(null!, null!, _textReader.Object); } [Test] public void ExecuteShowVariableReplacement() { - _sut.ReadSqlContent = "{{var1}} {{var1}}".AsFuncStream(); + var sqlContent = new MemoryStream(); + _sut.ReadSqlContent = () => sqlContent; + _textReader + .Setup(r => r.ReadBatches(sqlContent)) + .Returns(new[] { "{{var1}} {{var1}}" }); _executedReader .Setup(r => r.GetSchemaTable()) - .Returns((DataTable)null); + .Returns((DataTable)null!); _executedReader .Setup(r => r.Read()) .Returns(false); @@ -74,7 +77,7 @@ public void ExecuteShowVariableReplacement() .Setup(r => r.NextResult()) .Returns(false); - _sut.Execute(_command.Object, _variables, _logger.Object); + _sut.Execute(_command.Object, _variables.Object, _logger.Object); _executedScripts.Count.ShouldBe(1); _executedScripts[0].ShouldBe("[some value] [some value]"); @@ -87,16 +90,15 @@ public void ExecuteShowVariableReplacement() [Test] public void Execute() { - _sut.ReadSqlContent = @" -{{var1}} -go -text2 -go" - .AsFuncStream(); + var sqlContent = new MemoryStream(); + _sut.ReadSqlContent = () => sqlContent; + _textReader + .Setup(r => r.ReadBatches(sqlContent)) + .Returns(new[] { "{{var1}}", "text2" }); _executedReader .Setup(r => r.GetSchemaTable()) - .Returns((DataTable)null); + .Returns((DataTable)null!); _executedReader .Setup(r => r.Read()) .Returns(false); @@ -104,7 +106,7 @@ public void Execute() .Setup(r => r.NextResult()) .Returns(false); - _sut.Execute(_command.Object, _variables, _logger.Object); + _sut.Execute(_command.Object, _variables.Object, _logger.Object); _executedScripts.Count.ShouldBe(2); _executedScripts[0].ShouldBe("[some value]"); @@ -116,23 +118,28 @@ public void Execute() [Test] public void ExecuteWhatIf() { - _sut.ReadSqlContent = () => new MemoryStream(Encoding.Default.GetBytes(@" -{{var1}} -go -text2 -go")); + var sqlContent = new MemoryStream(); + _sut.ReadSqlContent = () => sqlContent; + _textReader + .Setup(r => r.ReadBatches(sqlContent)) + .Returns(new[] { "{{var1}}", "text2" }); - _sut.Execute(null, _variables, _logger.Object); + _sut.Execute(null, _variables.Object, _logger.Object); _executedScripts.ShouldBeEmpty(); + _textReader.VerifyAll(); } [Test] public void ExecuteReader() { - _sut.ReadSqlContent = "select {{var1}}".AsFuncStream(); + var sqlContent = new MemoryStream(); + _sut.ReadSqlContent = () => sqlContent; + _textReader + .Setup(r => r.ReadBatches(sqlContent)) + .Returns(new[] { "select {{var1}}" }); - var actual = _sut.ExecuteReader(_command.Object, _variables, _logger.Object).ToList(); + var actual = _sut.ExecuteReader(_command.Object, _variables.Object, _logger.Object).ToList(); _executedScripts.Count.ShouldBe(1); _executedScripts[0].ShouldBe("select [some value]"); @@ -146,15 +153,15 @@ public void ExecuteReader() [Test] public void GetDependencies() { - _sut.ReadSqlContent = @" --- module dependency: a 1.0 -go --- module dependency: b 1.0 -go" - .AsFuncStream(); + var sqlContent = new MemoryStream(); + _sut.ReadSqlContent = () => sqlContent; + _textReader + .Setup(r => r.ReadFirstBatch(sqlContent)) + .Returns("-- module dependency: a 1.0"); var actual = _sut.GetDependencies(); - actual.ShouldBe(new[] { new ScriptDependency("a", new Version("1.0")) }); + actual.ShouldNotBeNull(); + actual.ReadToEnd().ShouldBe("-- module dependency: a 1.0"); } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Export/DataExportLogger.cs b/Sources/SqlDatabase.Adapter.Sql/Export/DataExportLogger.cs similarity index 83% rename from Sources/SqlDatabase/Export/DataExportLogger.cs rename to Sources/SqlDatabase.Adapter.Sql/Export/DataExportLogger.cs index b7a1be15..6869d2fa 100644 --- a/Sources/SqlDatabase/Export/DataExportLogger.cs +++ b/Sources/SqlDatabase.Adapter.Sql/Export/DataExportLogger.cs @@ -2,9 +2,9 @@ using System.IO; using System.Text; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter.Sql.Export; -internal sealed class DataExportLogger : ILogger +public sealed class DataExportLogger : ILogger { private readonly ILogger _origin; @@ -19,7 +19,7 @@ public void Error(string message) using (var reader = new StringReader(message)) { - string line; + string? line; while ((line = reader.ReadLine()) != null) { if (escaped.Length > 0) @@ -34,7 +34,7 @@ public void Error(string message) _origin.Error(escaped.ToString()); } - public void Info(string message) + public void Info(string? message) { // ignore } diff --git a/Sources/SqlDatabase/Export/DataExporter.cs b/Sources/SqlDatabase.Adapter.Sql/Export/DataExporter.cs similarity index 86% rename from Sources/SqlDatabase/Export/DataExporter.cs rename to Sources/SqlDatabase.Adapter.Sql/Export/DataExporter.cs index 7122635b..d5e78033 100644 --- a/Sources/SqlDatabase/Export/DataExporter.cs +++ b/Sources/SqlDatabase.Adapter.Sql/Export/DataExporter.cs @@ -1,21 +1,21 @@ using System.Data; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter.Sql.Export; -internal sealed class DataExporter : IDataExporter +public sealed class DataExporter : IDataExporter { - public SqlWriterBase Output { get; set; } + public SqlWriterBase Output { get; set; } = null!; public int MaxInsertBatchSize { get; set; } = 500; - public ILogger Log { get; set; } + public ILogger Log { get; set; } = null!; public void Export(IDataReader source, string tableName) { ExportTable table; using (var metadata = source.GetSchemaTable()) { - table = Output.ReadSchemaTable(metadata, tableName); + table = Output.ReadSchemaTable(metadata!, tableName); } CreateTable(table); @@ -60,14 +60,14 @@ public void Export(IDataReader source, string tableName) batchNum++; rowNum = 0; - Log.Info("{0} rows".FormatWith(batchNum * MaxInsertBatchSize)); + Log.Info($"{batchNum * MaxInsertBatchSize} rows"); } } Output.BatchSeparator(); if (rowNum > 0) { - Log.Info("{0} rows".FormatWith((batchNum * MaxInsertBatchSize) + rowNum)); + Log.Info($"{(batchNum * MaxInsertBatchSize) + rowNum} rows"); } } diff --git a/Sources/SqlDatabase/Export/IDataExporter.cs b/Sources/SqlDatabase.Adapter.Sql/Export/IDataExporter.cs similarity index 67% rename from Sources/SqlDatabase/Export/IDataExporter.cs rename to Sources/SqlDatabase.Adapter.Sql/Export/IDataExporter.cs index 5cbddd36..dce30582 100644 --- a/Sources/SqlDatabase/Export/IDataExporter.cs +++ b/Sources/SqlDatabase.Adapter.Sql/Export/IDataExporter.cs @@ -1,8 +1,8 @@ using System.Data; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter.Sql.Export; -internal interface IDataExporter +public interface IDataExporter { SqlWriterBase Output { get; set; } diff --git a/Sources/SqlDatabase.Adapter.Sql/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Adapter.Sql/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c3b4fa92 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.Sql/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.Adapter.Sql.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter.Sql/SqlDatabase.Adapter.Sql.csproj b/Sources/SqlDatabase.Adapter.Sql/SqlDatabase.Adapter.Sql.csproj new file mode 100644 index 00000000..dfc4d620 --- /dev/null +++ b/Sources/SqlDatabase.Adapter.Sql/SqlDatabase.Adapter.Sql.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/Sources/SqlDatabase/Scripts/SqlScriptVariableParser.cs b/Sources/SqlDatabase.Adapter.Sql/SqlScriptVariableParser.cs similarity index 92% rename from Sources/SqlDatabase/Scripts/SqlScriptVariableParser.cs rename to Sources/SqlDatabase.Adapter.Sql/SqlScriptVariableParser.cs index 114a9524..1c491d63 100644 --- a/Sources/SqlDatabase/Scripts/SqlScriptVariableParser.cs +++ b/Sources/SqlDatabase.Adapter.Sql/SqlScriptVariableParser.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Text.RegularExpressions; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter.Sql; -internal sealed class SqlScriptVariableParser +public sealed class SqlScriptVariableParser { internal const string ValueIsHidden = "[value is hidden]"; @@ -59,7 +59,7 @@ private string Evaluator(Match match) var value = Variables.GetValue(name); if (value == null) { - throw new InvalidOperationException("Variable [{0}] not defined.".FormatWith(name)); + throw new InvalidOperationException($"Variable [{name}] not defined."); } OnVariablesReplace(name, value); diff --git a/Sources/SqlDatabase/Scripts/TextScript.cs b/Sources/SqlDatabase.Adapter.Sql/TextScript.cs similarity index 83% rename from Sources/SqlDatabase/Scripts/TextScript.cs rename to Sources/SqlDatabase.Adapter.Sql/TextScript.cs index e428f06a..e0c96e6f 100644 --- a/Sources/SqlDatabase/Scripts/TextScript.cs +++ b/Sources/SqlDatabase.Adapter.Sql/TextScript.cs @@ -5,17 +5,24 @@ using System.IO; using System.Linq; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter.Sql; internal sealed class TextScript : IScript { + public TextScript(string displayName, Func readSqlContent, ISqlTextReader textReader) + { + DisplayName = displayName; + ReadSqlContent = readSqlContent; + TextReader = textReader; + } + public string DisplayName { get; set; } - public Func ReadSqlContent { get; set; } + public Func ReadSqlContent { get; internal set; } - public ISqlTextReader TextReader { get; set; } + public ISqlTextReader TextReader { get; } - public void Execute(IDbCommand command, IVariables variables, ILogger logger) + public void Execute(IDbCommand? command, IVariables variables, ILogger logger) { var batches = ResolveBatches(variables, logger); @@ -67,9 +74,9 @@ public IEnumerable ExecuteReader(IDbCommand command, IVariables var } } - public IList GetDependencies() + public TextReader? GetDependencies() { - string batch; + string? batch; using (var sql = ReadSqlContent()) { batch = TextReader.ReadFirstBatch(sql); @@ -77,13 +84,13 @@ public IList GetDependencies() if (string.IsNullOrWhiteSpace(batch)) { - return new ScriptDependency[0]; + return null; } - return DependencyParser.ExtractDependencies(new StringReader(batch), DisplayName).ToArray(); + return new StringReader(batch); } - private static string[] GetReaderColumns(IDataReader reader) + private static string[]? GetReaderColumns(IDataReader reader) { using (var metadata = reader.GetSchemaTable()) { @@ -93,7 +100,7 @@ private static string[] GetReaderColumns(IDataReader reader) ?.Rows .Cast() .OrderBy(i => (int)i["ColumnOrdinal"]) - .Select(i => i["ColumnName"]?.ToString()) + .Select(i => i["ColumnName"].ToString()!) .ToArray(); } } @@ -150,9 +157,8 @@ private static void ReadWithOutput(IDataReader reader, string[] columns, ILogger } } - logger.Info("{0} row{1} selected".FormatWith( - rowsCount.ToString(CultureInfo.CurrentCulture), - rowsCount == 1 ? null : "s")); + var s = rowsCount == 1 ? null : "s"; + logger.Info($"{rowsCount} row{s} selected"); } private IEnumerable ResolveBatches(IVariables variables, ILogger logger) @@ -175,7 +181,7 @@ private IEnumerable ResolveBatches(IVariables variables, ILogger logger) var report = scriptParser.ValueByName.OrderBy(i => i.Key); foreach (var entry in report) { - logger.Info("variable {0} was replaced with {1}".FormatWith(entry.Key, entry.Value)); + logger.Info($"variable {entry.Key} was replaced with {entry.Value}"); } return batches; diff --git a/Sources/SqlDatabase.Adapter.Sql/TextScriptFactory.cs b/Sources/SqlDatabase.Adapter.Sql/TextScriptFactory.cs new file mode 100644 index 00000000..dd02563b --- /dev/null +++ b/Sources/SqlDatabase.Adapter.Sql/TextScriptFactory.cs @@ -0,0 +1,24 @@ +using System; +using SqlDatabase.FileSystem; + +namespace SqlDatabase.Adapter.Sql; + +public class TextScriptFactory : IScriptFactory +{ + private readonly ISqlTextReader _textReader; + + public TextScriptFactory(ISqlTextReader textReader) + { + _textReader = textReader; + } + + public bool IsSupported(IFile file) + { + return ".sql".Equals(file.Extension, StringComparison.OrdinalIgnoreCase); + } + + public IScript FromFile(IFile file) + { + return new TextScript(file.Name, file.OpenRead, _textReader); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Export/DataReaderTools.cs b/Sources/SqlDatabase.Adapter/DataReaderTools.cs similarity index 56% rename from Sources/SqlDatabase/Export/DataReaderTools.cs rename to Sources/SqlDatabase.Adapter/DataReaderTools.cs index 4926625c..6a5c845c 100644 --- a/Sources/SqlDatabase/Export/DataReaderTools.cs +++ b/Sources/SqlDatabase.Adapter/DataReaderTools.cs @@ -1,10 +1,10 @@ using System; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter; -internal static class DataReaderTools +public static class DataReaderTools { - public static object CleanValue(object value) + public static object? CleanValue(object? value) { if (value == null || Convert.IsDBNull(value)) { diff --git a/Sources/SqlDatabase.Adapter/ExportTable.cs b/Sources/SqlDatabase.Adapter/ExportTable.cs new file mode 100644 index 00000000..e80e4323 --- /dev/null +++ b/Sources/SqlDatabase.Adapter/ExportTable.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace SqlDatabase.Adapter; + +public sealed class ExportTable +{ + public ExportTable(string name) + { + Name = name; + Columns = new List(); + } + + public string Name { get; } + + public List Columns { get; } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Export/ExportTableColumn.cs b/Sources/SqlDatabase.Adapter/ExportTableColumn.cs similarity index 69% rename from Sources/SqlDatabase/Export/ExportTableColumn.cs rename to Sources/SqlDatabase.Adapter/ExportTableColumn.cs index 9f6843f9..d2b8a69f 100644 --- a/Sources/SqlDatabase/Export/ExportTableColumn.cs +++ b/Sources/SqlDatabase.Adapter/ExportTableColumn.cs @@ -1,6 +1,6 @@ -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter; -internal struct ExportTableColumn +public struct ExportTableColumn { public string Name { get; set; } @@ -16,6 +16,6 @@ internal struct ExportTableColumn public override string ToString() { - return "{0} {1}({2})".FormatWith(Name, SqlDataTypeName, Size); + return $"{Name} {SqlDataTypeName}({Size})"; } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/IDatabaseAdapter.cs b/Sources/SqlDatabase.Adapter/IDatabaseAdapter.cs similarity index 83% rename from Sources/SqlDatabase/Scripts/IDatabaseAdapter.cs rename to Sources/SqlDatabase.Adapter/IDatabaseAdapter.cs index a646ab38..4d45dfab 100644 --- a/Sources/SqlDatabase/Scripts/IDatabaseAdapter.cs +++ b/Sources/SqlDatabase.Adapter/IDatabaseAdapter.cs @@ -1,10 +1,9 @@ using System.Data; using System.IO; -using SqlDatabase.Export; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter; -internal interface IDatabaseAdapter +public interface IDatabaseAdapter { string DatabaseName { get; } diff --git a/Sources/SqlDatabase/ILogger.cs b/Sources/SqlDatabase.Adapter/ILogger.cs similarity index 81% rename from Sources/SqlDatabase/ILogger.cs rename to Sources/SqlDatabase.Adapter/ILogger.cs index 758015ec..bbc101a6 100644 --- a/Sources/SqlDatabase/ILogger.cs +++ b/Sources/SqlDatabase.Adapter/ILogger.cs @@ -1,6 +1,6 @@ using System; -namespace SqlDatabase; +namespace SqlDatabase.Adapter; public interface ILogger { diff --git a/Sources/SqlDatabase/Scripts/IScript.cs b/Sources/SqlDatabase.Adapter/IScript.cs similarity index 58% rename from Sources/SqlDatabase/Scripts/IScript.cs rename to Sources/SqlDatabase.Adapter/IScript.cs index 2cd6ce71..e842c882 100644 --- a/Sources/SqlDatabase/Scripts/IScript.cs +++ b/Sources/SqlDatabase.Adapter/IScript.cs @@ -1,15 +1,16 @@ using System.Collections.Generic; using System.Data; +using System.IO; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter; public interface IScript { string DisplayName { get; set; } - void Execute(IDbCommand command, IVariables variables, ILogger logger); + void Execute(IDbCommand? command, IVariables variables, ILogger logger); IEnumerable ExecuteReader(IDbCommand command, IVariables variables, ILogger logger); - IList GetDependencies(); + TextReader? GetDependencies(); } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter/IScriptEnvironment.cs b/Sources/SqlDatabase.Adapter/IScriptEnvironment.cs new file mode 100644 index 00000000..36c83eb1 --- /dev/null +++ b/Sources/SqlDatabase.Adapter/IScriptEnvironment.cs @@ -0,0 +1,8 @@ +namespace SqlDatabase.Adapter; + +public interface IScriptEnvironment +{ + bool IsSupported(IScript script); + + void Initialize(ILogger logger); +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter/IScriptFactory.cs b/Sources/SqlDatabase.Adapter/IScriptFactory.cs new file mode 100644 index 00000000..b4827922 --- /dev/null +++ b/Sources/SqlDatabase.Adapter/IScriptFactory.cs @@ -0,0 +1,10 @@ +using SqlDatabase.FileSystem; + +namespace SqlDatabase.Adapter; + +public interface IScriptFactory +{ + bool IsSupported(IFile file); + + IScript FromFile(IFile file); +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/ISqlTextReader.cs b/Sources/SqlDatabase.Adapter/ISqlTextReader.cs similarity index 51% rename from Sources/SqlDatabase/Scripts/ISqlTextReader.cs rename to Sources/SqlDatabase.Adapter/ISqlTextReader.cs index 1985cee0..a4e6aa77 100644 --- a/Sources/SqlDatabase/Scripts/ISqlTextReader.cs +++ b/Sources/SqlDatabase.Adapter/ISqlTextReader.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.IO; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Adapter; -internal interface ISqlTextReader +public interface ISqlTextReader { - string ReadFirstBatch(Stream sql); + string? ReadFirstBatch(Stream sql); IEnumerable ReadBatches(Stream sql); } \ No newline at end of file diff --git a/Sources/SqlDatabase.Adapter/IVariables.cs b/Sources/SqlDatabase.Adapter/IVariables.cs new file mode 100644 index 00000000..a02bd57e --- /dev/null +++ b/Sources/SqlDatabase.Adapter/IVariables.cs @@ -0,0 +1,6 @@ +namespace SqlDatabase.Adapter; + +public interface IVariables +{ + string? GetValue(string name); +} \ No newline at end of file diff --git a/Sources/SqlDatabase/LoggerExtensions.cs b/Sources/SqlDatabase.Adapter/LoggerExtensions.cs similarity index 73% rename from Sources/SqlDatabase/LoggerExtensions.cs rename to Sources/SqlDatabase.Adapter/LoggerExtensions.cs index 712a3ae9..a126501a 100644 --- a/Sources/SqlDatabase/LoggerExtensions.cs +++ b/Sources/SqlDatabase.Adapter/LoggerExtensions.cs @@ -1,11 +1,11 @@ using System; using System.Text; -namespace SqlDatabase; +namespace SqlDatabase.Adapter; -internal static class LoggerExtensions +public static class LoggerExtensions { - public static void Error(this ILogger logger, string message, Exception error) + public static void Error(this ILogger logger, string? message, Exception error) { var text = new StringBuilder(); if (!string.IsNullOrEmpty(message)) @@ -26,7 +26,7 @@ public static void Error(this ILogger logger, string message, Exception error) } logger.Error(text.ToString()); - logger.Info(error.StackTrace); + logger.Info(error.StackTrace ?? string.Empty); } public static void Error(this ILogger logger, Exception error) => Error(logger, null, error); diff --git a/Sources/SqlDatabase.Adapter/SqlDatabase.Adapter.csproj b/Sources/SqlDatabase.Adapter/SqlDatabase.Adapter.csproj new file mode 100644 index 00000000..d9293f13 --- /dev/null +++ b/Sources/SqlDatabase.Adapter/SqlDatabase.Adapter.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/Sources/SqlDatabase/Export/SqlWriterBase.cs b/Sources/SqlDatabase.Adapter/SqlWriterBase.cs similarity index 81% rename from Sources/SqlDatabase/Export/SqlWriterBase.cs rename to Sources/SqlDatabase.Adapter/SqlWriterBase.cs index e1c93206..f0f911e2 100644 --- a/Sources/SqlDatabase/Export/SqlWriterBase.cs +++ b/Sources/SqlDatabase.Adapter/SqlWriterBase.cs @@ -2,9 +2,9 @@ using System.Data; using System.IO; -namespace SqlDatabase.Export; +namespace SqlDatabase.Adapter; -internal abstract class SqlWriterBase : IDisposable +public abstract class SqlWriterBase : IDisposable { public const char Q = '\''; @@ -20,7 +20,7 @@ public void Dispose() Output.Dispose(); } - public SqlWriterBase Line(string value = null) + public SqlWriterBase Line(string? value = null) { Output.WriteLine(value); return this; @@ -32,7 +32,7 @@ public SqlWriterBase Text(string value) return this; } - public SqlWriterBase TextFormat(string format, params object[] args) + public SqlWriterBase TextFormat(string format, params object?[] args) { Output.Write(format, args); return this; @@ -50,7 +50,7 @@ public SqlWriterBase Null() return this; } - public SqlWriterBase Value(object value, string typeNameHint = null) + public SqlWriterBase Value(object? value, string? typeNameHint = null) { value = DataReaderTools.CleanValue(value); if (value == null) @@ -61,7 +61,7 @@ public SqlWriterBase Value(object value, string typeNameHint = null) if (!TryWriteValue(value, typeNameHint)) { - throw new NotSupportedException("Type [{0}] is not supported.".FormatWith(value.GetType())); + throw new NotSupportedException($"Type [{value.GetType()}] is not supported."); } return this; @@ -71,7 +71,7 @@ public SqlWriterBase Value(object value, string typeNameHint = null) public abstract string GetDefaultTableName(); - protected abstract bool TryWriteValue(object value, string typeNameHint); + protected abstract bool TryWriteValue(object value, string? typeNameHint); protected void ValueString(string value, char q = Q) { diff --git a/Sources/SqlDatabase.Configuration.Test/AppConfiguration.default.xml b/Sources/SqlDatabase.Configuration.Test/AppConfiguration.default.xml new file mode 100644 index 00000000..ed085568 --- /dev/null +++ b/Sources/SqlDatabase.Configuration.Test/AppConfiguration.default.xml @@ -0,0 +1,4 @@ + + + + diff --git a/Sources/SqlDatabase.Test/Configuration/AppConfiguration.empty.xml b/Sources/SqlDatabase.Configuration.Test/AppConfiguration.empty.xml similarity index 100% rename from Sources/SqlDatabase.Test/Configuration/AppConfiguration.empty.xml rename to Sources/SqlDatabase.Configuration.Test/AppConfiguration.empty.xml diff --git a/Sources/SqlDatabase.Test/Configuration/AppConfiguration.full.xml b/Sources/SqlDatabase.Configuration.Test/AppConfiguration.full.xml similarity index 87% rename from Sources/SqlDatabase.Test/Configuration/AppConfiguration.full.xml rename to Sources/SqlDatabase.Configuration.Test/AppConfiguration.full.xml index 205a728e..171431e9 100644 --- a/Sources/SqlDatabase.Test/Configuration/AppConfiguration.full.xml +++ b/Sources/SqlDatabase.Configuration.Test/AppConfiguration.full.xml @@ -1,10 +1,5 @@  - -
- - + + +"; + + private TempDirectory _temp = null!; + private ConfigurationManager _sut = null!; + + [SetUp] + public void BeforeEachTest() + { + _temp = new TempDirectory(); + _sut = new ConfigurationManager(); + } + + [TearDown] + public void AfterEachTest() + { + _temp.Dispose(); + } + + [Test] + public void LoadFromCurrentConfiguration() + { + _sut.LoadFrom((string?)null); + + _sut.SqlDatabase.ShouldNotBeNull(); + _sut.SqlDatabase.Variables.Keys.ShouldBe(new[] { nameof(ConfigurationManagerTest) }); + _sut.SqlDatabase.Variables[nameof(ConfigurationManagerTest)].ShouldBe(nameof(LoadFromCurrentConfiguration)); + } + + [Test] + public void LoadFromEmptyFile() + { + var fileName = Path.Combine(_temp.Location, "app.config"); + File.WriteAllText(fileName, ""); + + _sut.LoadFrom(fileName); + + _sut.SqlDatabase.ShouldNotBeNull(); + } + + [Test] + public void LoadFromFile() + { + var fileName = Path.Combine(_temp.Location, "app.config"); + File.WriteAllText(fileName, SomeConfiguration); + + _sut.LoadFrom(fileName); + + _sut.SqlDatabase.ShouldNotBeNull(); + _sut.SqlDatabase.GetCurrentVersionScript.ShouldBe("expected"); + } + + [Test] + [TestCase(ConfigurationManager.Name1)] + [TestCase(ConfigurationManager.Name2)] + public void LoadFromDirectory(string fileName) + { + File.WriteAllText(Path.Combine(_temp.Location, fileName), SomeConfiguration); + + _sut.LoadFrom(_temp.Location); + + _sut.SqlDatabase.ShouldNotBeNull(); + _sut.SqlDatabase.GetCurrentVersionScript.ShouldBe("expected"); + } + + [Test] + public void NotFoundInDirectory() + { + Assert.Throws(() => _sut.LoadFrom(_temp.Location)); + } + + [Test] + public void FileNotFound() + { + var fileName = Path.Combine(_temp.Location, "app.config"); + + Assert.Throws(() => _sut.LoadFrom(fileName)); + } + + [Test] + public void LoadInvalidConfiguration() + { + var fileName = Path.Combine(_temp.Location, "app.config"); + File.WriteAllText(fileName, ""); + + Assert.Throws(() => _sut.LoadFrom(fileName)); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration.Test/SqlDatabase.Configuration.Test.csproj b/Sources/SqlDatabase.Configuration.Test/SqlDatabase.Configuration.Test.csproj new file mode 100644 index 00000000..ea917321 --- /dev/null +++ b/Sources/SqlDatabase.Configuration.Test/SqlDatabase.Configuration.Test.csproj @@ -0,0 +1,28 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Configuration + + + + + + + + + + + + + + + + + + + + Always + + + diff --git a/Sources/SqlDatabase.Configuration.Test/SqlDatabase.dll.config b/Sources/SqlDatabase.Configuration.Test/SqlDatabase.dll.config new file mode 100644 index 00000000..9fb7053c --- /dev/null +++ b/Sources/SqlDatabase.Configuration.Test/SqlDatabase.dll.config @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration/AppConfiguration.cs b/Sources/SqlDatabase.Configuration/AppConfiguration.cs new file mode 100644 index 00000000..30a37c5f --- /dev/null +++ b/Sources/SqlDatabase.Configuration/AppConfiguration.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace SqlDatabase.Configuration; + +public sealed class AppConfiguration +{ + public const string SectionName = "sqlDatabase"; + + internal const string PropertyGetCurrentVersionScript = "getCurrentVersion"; + internal const string PropertySetCurrentVersionScript = "setCurrentVersion"; + internal const string PropertyAssemblyScript = "assemblyScript"; + internal const string PropertyVariables = "variables"; + internal const string PropertyMsSql = "mssql"; + internal const string PropertyPgSql = "pgsql"; + internal const string PropertyMySql = "mysql"; + + public string? GetCurrentVersionScript { get; set; } + + public string? SetCurrentVersionScript { get; set; } + + public AssemblyScriptConfiguration AssemblyScript { get; } = new(); + + public Dictionary Variables { get; } = new(StringComparer.OrdinalIgnoreCase); + + public DatabaseConfiguration MsSql { get; } = new(); + + public DatabaseConfiguration PgSql { get; } = new(); + + public DatabaseConfiguration MySql { get; } = new(); +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration/AssemblyScriptConfiguration.cs b/Sources/SqlDatabase.Configuration/AssemblyScriptConfiguration.cs new file mode 100644 index 00000000..1a14ad6e --- /dev/null +++ b/Sources/SqlDatabase.Configuration/AssemblyScriptConfiguration.cs @@ -0,0 +1,11 @@ +namespace SqlDatabase.Configuration; + +public sealed class AssemblyScriptConfiguration +{ + internal const string PropertyClassName = "className"; + internal const string PropertyMethodName = "methodName"; + + public string? ClassName { get; set; } + + public string? MethodName { get; set; } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration/ConfigurationErrorsException.cs b/Sources/SqlDatabase.Configuration/ConfigurationErrorsException.cs new file mode 100644 index 00000000..bdc00ae7 --- /dev/null +++ b/Sources/SqlDatabase.Configuration/ConfigurationErrorsException.cs @@ -0,0 +1,20 @@ +using System; + +namespace SqlDatabase.Configuration; + +public sealed class ConfigurationErrorsException : ApplicationException +{ + public ConfigurationErrorsException() + { + } + + public ConfigurationErrorsException(string message) + : base(message) + { + } + + public ConfigurationErrorsException(string message, Exception inner) + : base(message, inner) + { + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration/ConfigurationManager.cs b/Sources/SqlDatabase.Configuration/ConfigurationManager.cs new file mode 100644 index 00000000..f687c454 --- /dev/null +++ b/Sources/SqlDatabase.Configuration/ConfigurationManager.cs @@ -0,0 +1,75 @@ +using System; +using System.IO; +using System.Linq; +using SqlDatabase.FileSystem; + +namespace SqlDatabase.Configuration; + +public sealed class ConfigurationManager : IConfigurationManager +{ + internal const string Name1 = "SqlDatabase.exe.config"; + internal const string Name2 = "SqlDatabase.dll.config"; + + public AppConfiguration SqlDatabase { get; private set; } = null!; + + public static string ResolveDefaultConfigurationFile(string probingPath) + { + var fileName = ResolveConfigurationFile(probingPath).Name; + return Path.Combine(probingPath, fileName); + } + + public void LoadFrom(string? configurationFile) + { + IFile source; + if (string.IsNullOrWhiteSpace(configurationFile)) + { + source = ResolveConfigurationFile(Path.GetDirectoryName(GetType().Assembly.Location)); + } + else + { + source = ResolveConfigurationFile(configurationFile!); + } + + try + { + using (var stream = source.OpenRead()) + { + SqlDatabase = ConfigurationReader.Read(stream); + } + } + catch (Exception ex) when ((ex as IOException) == null) + { + throw new ConfigurationErrorsException($"Fail to load configuration from [{configurationFile}].", ex); + } + } + + private static IFile ResolveConfigurationFile(string probingPath) + { + var info = FileSystemFactory.FileSystemInfoFromPath(probingPath); + return ResolveFile(info); + } + + private static IFile ResolveFile(IFileSystemInfo info) + { + IFile? file; + if (info is IFolder folder) + { + file = folder + .GetFiles() + .Where(i => Name1.Equals(i.Name, StringComparison.OrdinalIgnoreCase) || Name2.Equals(i.Name, StringComparison.OrdinalIgnoreCase)) + .OrderByDescending(i => i.Name, StringComparer.OrdinalIgnoreCase) + .FirstOrDefault(); + + if (file == null) + { + throw new FileNotFoundException($"Configuration file {Name2} not found in {info.Name}."); + } + } + else + { + file = (IFile)info; + } + + return file; + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration/ConfigurationReader.cs b/Sources/SqlDatabase.Configuration/ConfigurationReader.cs new file mode 100644 index 00000000..b728ee18 --- /dev/null +++ b/Sources/SqlDatabase.Configuration/ConfigurationReader.cs @@ -0,0 +1,98 @@ +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; + +namespace SqlDatabase.Configuration; + +internal static class ConfigurationReader +{ + public static AppConfiguration Read(Stream source) + { + var doc = new XmlDocument(); + doc.Load(source); + + var root = doc.SelectSingleNode($"configuration/{AppConfiguration.SectionName}"); + + var result = new AppConfiguration(); + if (root == null) + { + return result; + } + + result.GetCurrentVersionScript = root.GetAttribute(AppConfiguration.PropertyGetCurrentVersionScript); + result.SetCurrentVersionScript = root.GetAttribute(AppConfiguration.PropertySetCurrentVersionScript); + + ReadAssemblyScript(root.SelectSingleNode(AppConfiguration.PropertyAssemblyScript), result.AssemblyScript); + ReadVariables(root.SelectSingleNode(AppConfiguration.PropertyVariables), result.Variables); + ReadDatabase(root.SelectSingleNode(AppConfiguration.PropertyMsSql), result.MsSql); + ReadDatabase(root.SelectSingleNode(AppConfiguration.PropertyMySql), result.MySql); + ReadDatabase(root.SelectSingleNode(AppConfiguration.PropertyPgSql), result.PgSql); + + return result; + } + + private static void ReadVariables(XmlNode? source, Dictionary destination) + { + var entries = source?.SelectNodes("add"); + if (entries == null) + { + return; + } + + foreach (XmlNode entry in entries) + { + var name = entry.GetAttribute("name"); + var value = entry.GetAttribute("value"); + + if (string.IsNullOrWhiteSpace(name)) + { + throw new ConfigurationErrorsException($"The element {GetPath(entry)} does not contain expected attribute [name]."); + } + + if (destination.ContainsKey(name!)) + { + throw new ConfigurationErrorsException($"The element {GetPath(entry)} is duplicated, [name = {name}]."); + } + + destination.Add(name!, value ?? string.Empty); + } + } + + private static void ReadAssemblyScript(XmlNode? source, AssemblyScriptConfiguration destination) + { + destination.ClassName = source.GetAttribute(AssemblyScriptConfiguration.PropertyClassName); + destination.MethodName = source.GetAttribute(AssemblyScriptConfiguration.PropertyMethodName); + } + + private static void ReadDatabase(XmlNode? source, DatabaseConfiguration destination) + { + destination.GetCurrentVersionScript = source.GetAttribute(DatabaseConfiguration.PropertyGetCurrentVersionScript); + destination.SetCurrentVersionScript = source.GetAttribute(DatabaseConfiguration.PropertySetCurrentVersionScript); + ReadVariables(source?.SelectSingleNode(DatabaseConfiguration.PropertyVariables), destination.Variables); + } + + private static string? GetAttribute(this XmlNode? node, string name) + { + return node?.Attributes?[name]?.Value; + } + + private static string GetPath(XmlNode node) + { + var result = new StringBuilder(); + + XmlNode? current = node; + while (current != null) + { + if (result.Length > 0) + { + result.Insert(0, '/'); + } + + result.Insert(0, current.Name); + current = node.ParentNode; + } + + return result.ToString(); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration/DatabaseConfiguration.cs b/Sources/SqlDatabase.Configuration/DatabaseConfiguration.cs new file mode 100644 index 00000000..33891f8b --- /dev/null +++ b/Sources/SqlDatabase.Configuration/DatabaseConfiguration.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace SqlDatabase.Configuration; + +public sealed class DatabaseConfiguration +{ + internal const string PropertyGetCurrentVersionScript = "getCurrentVersion"; + internal const string PropertySetCurrentVersionScript = "setCurrentVersion"; + internal const string PropertyVariables = "variables"; + + public string? GetCurrentVersionScript { get; set; } + + public string? SetCurrentVersionScript { get; set; } + + public Dictionary Variables { get; } = new(StringComparer.OrdinalIgnoreCase); +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/IConfigurationManager.cs b/Sources/SqlDatabase.Configuration/IConfigurationManager.cs similarity index 100% rename from Sources/SqlDatabase/Configuration/IConfigurationManager.cs rename to Sources/SqlDatabase.Configuration/IConfigurationManager.cs diff --git a/Sources/SqlDatabase.Configuration/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Configuration/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..a33b37ec --- /dev/null +++ b/Sources/SqlDatabase.Configuration/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.Configuration.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.Configuration/SqlDatabase.Configuration.csproj b/Sources/SqlDatabase.Configuration/SqlDatabase.Configuration.csproj new file mode 100644 index 00000000..c674cb4e --- /dev/null +++ b/Sources/SqlDatabase.Configuration/SqlDatabase.Configuration.csproj @@ -0,0 +1,10 @@ + + + + netstandard2.0 + + + + + + diff --git a/Sources/SqlDatabase.Test/IO/Content.zip b/Sources/SqlDatabase.FileSystem.Test/Content.zip similarity index 100% rename from Sources/SqlDatabase.Test/IO/Content.zip rename to Sources/SqlDatabase.FileSystem.Test/Content.zip diff --git a/Sources/SqlDatabase.Test/IO/FileSystemFactoryTest.cs b/Sources/SqlDatabase.FileSystem.Test/FileSystemFactoryTest.cs similarity index 99% rename from Sources/SqlDatabase.Test/IO/FileSystemFactoryTest.cs rename to Sources/SqlDatabase.FileSystem.Test/FileSystemFactoryTest.cs index 46f175ed..c15a81c8 100644 --- a/Sources/SqlDatabase.Test/IO/FileSystemFactoryTest.cs +++ b/Sources/SqlDatabase.FileSystem.Test/FileSystemFactoryTest.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using SqlDatabase.TestApi; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [TestFixture] public class FileSystemFactoryTest diff --git a/Sources/SqlDatabase.Test/IO/FileSystemFileTest.cs b/Sources/SqlDatabase.FileSystem.Test/FileSystemFileTest.cs similarity index 95% rename from Sources/SqlDatabase.Test/IO/FileSystemFileTest.cs rename to Sources/SqlDatabase.FileSystem.Test/FileSystemFileTest.cs index 9e748747..2a53e63e 100644 --- a/Sources/SqlDatabase.Test/IO/FileSystemFileTest.cs +++ b/Sources/SqlDatabase.FileSystem.Test/FileSystemFileTest.cs @@ -3,7 +3,7 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [TestFixture] public class FileSystemFileTest diff --git a/Sources/SqlDatabase.Test/IO/FileSystemFolderTest.cs b/Sources/SqlDatabase.FileSystem.Test/FileSystemFolderTest.cs similarity index 98% rename from Sources/SqlDatabase.Test/IO/FileSystemFolderTest.cs rename to Sources/SqlDatabase.FileSystem.Test/FileSystemFolderTest.cs index 4fcf981b..3c7c3e95 100644 --- a/Sources/SqlDatabase.Test/IO/FileSystemFolderTest.cs +++ b/Sources/SqlDatabase.FileSystem.Test/FileSystemFolderTest.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using SqlDatabase.TestApi; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [TestFixture] public class FileSystemFolderTest diff --git a/Sources/SqlDatabase.Test/IO/InLineScriptFileTest.cs b/Sources/SqlDatabase.FileSystem.Test/InLineScriptFileTest.cs similarity index 94% rename from Sources/SqlDatabase.Test/IO/InLineScriptFileTest.cs rename to Sources/SqlDatabase.FileSystem.Test/InLineScriptFileTest.cs index 0bb1956b..fe6133ba 100644 --- a/Sources/SqlDatabase.Test/IO/InLineScriptFileTest.cs +++ b/Sources/SqlDatabase.FileSystem.Test/InLineScriptFileTest.cs @@ -2,7 +2,7 @@ using NUnit.Framework; using Shouldly; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [TestFixture] public class InLineScriptFileTest diff --git a/Sources/SqlDatabase.FileSystem.Test/SqlDatabase.FileSystem.Test.csproj b/Sources/SqlDatabase.FileSystem.Test/SqlDatabase.FileSystem.Test.csproj new file mode 100644 index 00000000..ce4bdfe7 --- /dev/null +++ b/Sources/SqlDatabase.FileSystem.Test/SqlDatabase.FileSystem.Test.csproj @@ -0,0 +1,23 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.FileSystem + + + + + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/IO/ZipFolderTest.cs b/Sources/SqlDatabase.FileSystem.Test/ZipFolderTest.cs similarity index 89% rename from Sources/SqlDatabase.Test/IO/ZipFolderTest.cs rename to Sources/SqlDatabase.FileSystem.Test/ZipFolderTest.cs index b865f165..5c0048c6 100644 --- a/Sources/SqlDatabase.Test/IO/ZipFolderTest.cs +++ b/Sources/SqlDatabase.FileSystem.Test/ZipFolderTest.cs @@ -4,13 +4,13 @@ using Shouldly; using SqlDatabase.TestApi; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [TestFixture] public class ZipFolderTest { - private TempDirectory _temp; - private ZipFolder _sut; + private TempDirectory _temp = null!; + private ZipFolder _sut = null!; [SetUp] public void BeforeEachTest() @@ -55,7 +55,7 @@ public void GetFiles() Assert.AreEqual("11", reader.ReadToEnd()); } - files[0].GetParent().GetFiles().OrderBy(i => i.Name).First().ShouldBe(files[0]); + files[0].GetParent()!.GetFiles().OrderBy(i => i.Name).First().ShouldBe(files[0]); } [Test] @@ -98,6 +98,6 @@ public void ReadContentOfEmbeddedZip() Assert.AreEqual("11", reader.ReadToEnd()); } - files[0].GetParent().GetFiles().OrderBy(i => i.Name).First().ShouldBe(files[0]); + files[0].GetParent()!.GetFiles().OrderBy(i => i.Name).First().ShouldBe(files[0]); } } \ No newline at end of file diff --git a/Sources/SqlDatabase/IO/FileSystemFactory.cs b/Sources/SqlDatabase.FileSystem/FileSystemFactory.cs similarity index 68% rename from Sources/SqlDatabase/IO/FileSystemFactory.cs rename to Sources/SqlDatabase.FileSystem/FileSystemFactory.cs index 80a25681..835dff00 100644 --- a/Sources/SqlDatabase/IO/FileSystemFactory.cs +++ b/Sources/SqlDatabase.FileSystem/FileSystemFactory.cs @@ -3,17 +3,17 @@ using System.IO; using System.Linq; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; -internal sealed class FileSystemFactory : IFileSystemFactory +public sealed class FileSystemFactory : IFileSystemFactory { - public static IFileSystemInfo FileSystemInfoFromPath(string path) + public static IFileSystemInfo FileSystemInfoFromPath(string? path) { path = FileTools.RootPath(path); if (File.Exists(path)) { - return FileTools.IsZip(path) ? (IFileSystemInfo)new ZipFolder(path) : new FileSystemFile(path); + return FileTools.IsZip(path) ? new ZipFolder(path) : new FileSystemFile(path); } if (Directory.Exists(path)) @@ -21,7 +21,7 @@ public static IFileSystemInfo FileSystemInfoFromPath(string path) return new FileSystemFolder(path); } - IFolder entryPoint = null; + IFolder? entryPoint = null; var items = new List(); while (!string.IsNullOrEmpty(path)) @@ -38,23 +38,23 @@ public static IFileSystemInfo FileSystemInfoFromPath(string path) if (entryPoint == null) { - throw new IOException("Directory {0} not found.".FormatWith(path)); + throw new IOException($"Directory {path} not found."); } for (var i = 0; i < items.Count - 1; i++) { var name = items[i]; - path = Path.Combine(path, name); + path = Path.Combine(path!, name); entryPoint = entryPoint.GetFolders().FirstOrDefault(f => name.Equals(f.Name, StringComparison.OrdinalIgnoreCase)); if (entryPoint == null) { - throw new IOException("Directory {0} not found.".FormatWith(path)); + throw new IOException($"Directory {path} not found."); } } var resultName = items.Last(); - path = Path.Combine(path, resultName); + path = Path.Combine(path!, resultName); var file = entryPoint.GetFiles().FirstOrDefault(f => resultName.Equals(f.Name, StringComparison.OrdinalIgnoreCase)); if (file != null) @@ -65,20 +65,20 @@ public static IFileSystemInfo FileSystemInfoFromPath(string path) var folder = entryPoint.GetFolders().FirstOrDefault(f => resultName.Equals(f.Name, StringComparison.OrdinalIgnoreCase)); if (folder == null) { - throw new IOException("File or folder {0} not found.".FormatWith(path)); + throw new IOException($"File or folder {path} not found."); } return folder; } - IFileSystemInfo IFileSystemFactory.FileSystemInfoFromPath(string path) => FileSystemInfoFromPath(path); + IFileSystemInfo IFileSystemFactory.FileSystemInfoFromPath(string? path) => FileSystemInfoFromPath(path); public IFileSystemInfo FromContent(string name, string content) { return new InLineScriptFile(name, content); } - private static IFolder TryToResolveEntryPoint(string path) + private static IFolder? TryToResolveEntryPoint(string path) { if (Directory.Exists(path)) { @@ -89,7 +89,7 @@ private static IFolder TryToResolveEntryPoint(string path) { if (!FileTools.IsZip(path)) { - throw new NotSupportedException("File format [{0}] is not supported as .zip container.".FormatWith(Path.GetExtension(path))); + throw new NotSupportedException($"File format [{Path.GetExtension(path)}] is not supported as .zip container."); } return new ZipFolder(path); diff --git a/Sources/SqlDatabase/IO/FileSystemFile.cs b/Sources/SqlDatabase.FileSystem/FileSystemFile.cs similarity index 78% rename from Sources/SqlDatabase/IO/FileSystemFile.cs rename to Sources/SqlDatabase.FileSystem/FileSystemFile.cs index 2008c808..1ab6b787 100644 --- a/Sources/SqlDatabase/IO/FileSystemFile.cs +++ b/Sources/SqlDatabase.FileSystem/FileSystemFile.cs @@ -1,6 +1,6 @@ using System.IO; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; internal sealed class FileSystemFile : IFile { @@ -8,15 +8,18 @@ public FileSystemFile(string location) { Location = location; Name = Path.GetFileName(location); + Extension = Path.GetExtension(Name); } public string Name { get; } public string Location { get; } + public string Extension { get; } + public IFolder GetParent() { - return new FileSystemFolder(Path.GetDirectoryName(Location)); + return new FileSystemFolder(Path.GetDirectoryName(Location)!); } public Stream OpenRead() diff --git a/Sources/SqlDatabase/IO/FileSystemFolder.cs b/Sources/SqlDatabase.FileSystem/FileSystemFolder.cs similarity index 96% rename from Sources/SqlDatabase/IO/FileSystemFolder.cs rename to Sources/SqlDatabase.FileSystem/FileSystemFolder.cs index 14047d43..da1877b2 100644 --- a/Sources/SqlDatabase/IO/FileSystemFolder.cs +++ b/Sources/SqlDatabase.FileSystem/FileSystemFolder.cs @@ -2,7 +2,7 @@ using System.IO; using System.Linq; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; internal sealed class FileSystemFolder : IFolder { diff --git a/Sources/SqlDatabase/IO/FileTools.cs b/Sources/SqlDatabase.FileSystem/FileTools.cs similarity index 89% rename from Sources/SqlDatabase/IO/FileTools.cs rename to Sources/SqlDatabase.FileSystem/FileTools.cs index 891b1706..280a16b1 100644 --- a/Sources/SqlDatabase/IO/FileTools.cs +++ b/Sources/SqlDatabase.FileSystem/FileTools.cs @@ -2,14 +2,14 @@ using System.Collections.Generic; using System.IO; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; internal static class FileTools { private const string ZipExtension = ".zip"; private const string NuGetExtension = ".nupkg"; - public static string RootPath(string path) + public static string RootPath(string? path) { if (string.IsNullOrEmpty(path)) { @@ -21,7 +21,7 @@ public static string RootPath(string path) return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path); } - return path; + return path!; } public static IEnumerable GetZipExtensions() diff --git a/Sources/SqlDatabase.FileSystem/IFile.cs b/Sources/SqlDatabase.FileSystem/IFile.cs new file mode 100644 index 00000000..1d095d54 --- /dev/null +++ b/Sources/SqlDatabase.FileSystem/IFile.cs @@ -0,0 +1,12 @@ +using System.IO; + +namespace SqlDatabase.FileSystem; + +public interface IFile : IFileSystemInfo +{ + string Extension { get; } + + IFolder? GetParent(); + + Stream OpenRead(); +} \ No newline at end of file diff --git a/Sources/SqlDatabase.FileSystem/IFileSystemFactory.cs b/Sources/SqlDatabase.FileSystem/IFileSystemFactory.cs new file mode 100644 index 00000000..eb3bf85c --- /dev/null +++ b/Sources/SqlDatabase.FileSystem/IFileSystemFactory.cs @@ -0,0 +1,8 @@ +namespace SqlDatabase.FileSystem; + +public interface IFileSystemFactory +{ + IFileSystemInfo FileSystemInfoFromPath(string? path); + + IFileSystemInfo FromContent(string name, string content); +} \ No newline at end of file diff --git a/Sources/SqlDatabase/IO/IFileSystemInfo.cs b/Sources/SqlDatabase.FileSystem/IFileSystemInfo.cs similarity index 62% rename from Sources/SqlDatabase/IO/IFileSystemInfo.cs rename to Sources/SqlDatabase.FileSystem/IFileSystemInfo.cs index 067b12fc..607562d4 100644 --- a/Sources/SqlDatabase/IO/IFileSystemInfo.cs +++ b/Sources/SqlDatabase.FileSystem/IFileSystemInfo.cs @@ -1,4 +1,4 @@ -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; public interface IFileSystemInfo { diff --git a/Sources/SqlDatabase/IO/IFolder.cs b/Sources/SqlDatabase.FileSystem/IFolder.cs similarity index 82% rename from Sources/SqlDatabase/IO/IFolder.cs rename to Sources/SqlDatabase.FileSystem/IFolder.cs index 381ec61a..3122829c 100644 --- a/Sources/SqlDatabase/IO/IFolder.cs +++ b/Sources/SqlDatabase.FileSystem/IFolder.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; public interface IFolder : IFileSystemInfo { diff --git a/Sources/SqlDatabase/IO/InLineScriptFile.cs b/Sources/SqlDatabase.FileSystem/InLineScriptFile.cs similarity index 70% rename from Sources/SqlDatabase/IO/InLineScriptFile.cs rename to Sources/SqlDatabase.FileSystem/InLineScriptFile.cs index af7af432..22007008 100644 --- a/Sources/SqlDatabase/IO/InLineScriptFile.cs +++ b/Sources/SqlDatabase.FileSystem/InLineScriptFile.cs @@ -1,7 +1,7 @@ using System.IO; using System.Text; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; internal sealed class InLineScriptFile : IFile { @@ -9,13 +9,16 @@ public InLineScriptFile(string name, string content) { Name = name; Content = content; + Extension = Path.GetExtension(name); } public string Name { get; } public string Content { get; } - public IFolder GetParent() => null; + public string Extension { get; } + + public IFolder? GetParent() => null; public Stream OpenRead() { diff --git a/Sources/SqlDatabase.FileSystem/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.FileSystem/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..22d6abb5 --- /dev/null +++ b/Sources/SqlDatabase.FileSystem/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.FileSystem.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.FileSystem/SqlDatabase.FileSystem.csproj b/Sources/SqlDatabase.FileSystem/SqlDatabase.FileSystem.csproj new file mode 100644 index 00000000..dbdcea46 --- /dev/null +++ b/Sources/SqlDatabase.FileSystem/SqlDatabase.FileSystem.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/Sources/SqlDatabase/IO/ZipEntryFolder.cs b/Sources/SqlDatabase.FileSystem/ZipEntryFolder.cs similarity index 94% rename from Sources/SqlDatabase/IO/ZipEntryFolder.cs rename to Sources/SqlDatabase.FileSystem/ZipEntryFolder.cs index eba581f0..2dbf2ce7 100644 --- a/Sources/SqlDatabase/IO/ZipEntryFolder.cs +++ b/Sources/SqlDatabase.FileSystem/ZipEntryFolder.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [DebuggerDisplay("{Name}")] internal sealed class ZipEntryFolder : IFolder diff --git a/Sources/SqlDatabase/IO/ZipFolder.cs b/Sources/SqlDatabase.FileSystem/ZipFolder.cs similarity index 94% rename from Sources/SqlDatabase/IO/ZipFolder.cs rename to Sources/SqlDatabase.FileSystem/ZipFolder.cs index f0dda263..e2844b1b 100644 --- a/Sources/SqlDatabase/IO/ZipFolder.cs +++ b/Sources/SqlDatabase.FileSystem/ZipFolder.cs @@ -5,20 +5,20 @@ using System.IO.Compression; using System.Linq; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [DebuggerDisplay("{Name}")] internal sealed class ZipFolder : IFolder { - private readonly ZipFolder _parent; - private IFolder _tree; + private readonly ZipFolder? _parent; + private IFolder? _tree; public ZipFolder(string fileName) : this(null, fileName) { } - public ZipFolder(ZipFolder parent, string zipEntryFullName) + public ZipFolder(ZipFolder? parent, string zipEntryFullName) { _parent = parent; diff --git a/Sources/SqlDatabase/IO/ZipFolderFile.EntryStream.cs b/Sources/SqlDatabase.FileSystem/ZipFolderFile.EntryStream.cs similarity index 97% rename from Sources/SqlDatabase/IO/ZipFolderFile.EntryStream.cs rename to Sources/SqlDatabase.FileSystem/ZipFolderFile.EntryStream.cs index 47d74217..b4853cc9 100644 --- a/Sources/SqlDatabase/IO/ZipFolderFile.EntryStream.cs +++ b/Sources/SqlDatabase.FileSystem/ZipFolderFile.EntryStream.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; internal partial class ZipFolderFile { diff --git a/Sources/SqlDatabase/IO/ZipFolderFile.cs b/Sources/SqlDatabase.FileSystem/ZipFolderFile.cs similarity index 80% rename from Sources/SqlDatabase/IO/ZipFolderFile.cs rename to Sources/SqlDatabase.FileSystem/ZipFolderFile.cs index 77aeddcc..00088c2e 100644 --- a/Sources/SqlDatabase/IO/ZipFolderFile.cs +++ b/Sources/SqlDatabase.FileSystem/ZipFolderFile.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.IO; -namespace SqlDatabase.IO; +namespace SqlDatabase.FileSystem; [DebuggerDisplay(@"zip\{EntryName}")] internal sealed partial class ZipFolderFile : IFile @@ -16,12 +16,15 @@ public ZipFolderFile(ZipFolder container, IFolder parent, string entryFullName) EntryFullName = entryFullName; Name = Path.GetFileName(entryFullName); + Extension = Path.GetExtension(Name); } public string Name { get; } public string EntryFullName { get; } + public string Extension { get; } + public IFolder GetParent() => _parent; public Stream OpenRead() @@ -29,6 +32,6 @@ public Stream OpenRead() var content = _container.OpenRead(); var entry = content.GetEntry(EntryFullName); - return new EntryStream(content, entry.Open()); + return new EntryStream(content, entry!.Open()); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Package/SqlDatabase.Package.csproj b/Sources/SqlDatabase.Package/SqlDatabase.Package.csproj index d4ff9caa..727d501d 100644 --- a/Sources/SqlDatabase.Package/SqlDatabase.Package.csproj +++ b/Sources/SqlDatabase.Package/SqlDatabase.Package.csproj @@ -1,6 +1,6 @@ - net452 + net472 diff --git a/Sources/SqlDatabase.Package/nuget/package.nuspec b/Sources/SqlDatabase.Package/nuget/package.nuspec index 8ac4b68f..7e94f6dd 100644 --- a/Sources/SqlDatabase.Package/nuget/package.nuspec +++ b/Sources/SqlDatabase.Package/nuget/package.nuspec @@ -14,7 +14,7 @@ Command-line tool and PowerShell module for MSSQL Server, PostgreSQL and MySQL. SqlDatabase is a tool for MSSQL Server, PostgreSQL and MySQL, allows to execute scripts, database migrations and export data. https://github.com/max-ieremenko/SqlDatabase/releases - (C) 2018-2022 Max Ieremenko. + (C) 2018-2023 Max Ieremenko. sqlserver postgresql mysql mysql-database sqlcmd migration-tool c-sharp command-line-tool miration-step sql-script sql-database database-migrations export-data diff --git a/Sources/SqlDatabase.PowerShell.Test/InfoCmdLetTest.cs b/Sources/SqlDatabase.PowerShell.Test/InfoCmdLetTest.cs index 1c5d3f2c..a1dac9d4 100644 --- a/Sources/SqlDatabase.PowerShell.Test/InfoCmdLetTest.cs +++ b/Sources/SqlDatabase.PowerShell.Test/InfoCmdLetTest.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Shouldly; using SqlDatabase.PowerShell.TestApi; +using SqlDatabase.TestApi; namespace SqlDatabase.PowerShell; @@ -15,7 +16,7 @@ public void ProcessRecord() var actual = InvokeCommand("Show-SqlDatabaseInfo"); actual.Count.ShouldBe(1); - Console.WriteLine(actual[0]); + TestOutput.WriteLine(actual[0]); actual[0].Properties["PSEdition"].Value.ShouldBeOfType().ShouldNotBeNullOrWhiteSpace(); actual[0].Properties["PSVersion"].Value.ShouldBeOfType().ShouldNotBeNullOrWhiteSpace(); diff --git a/Sources/SqlDatabase.PowerShell.Test/Internal/DependencyResolverFactoryTest.cs b/Sources/SqlDatabase.PowerShell.Test/Internal/DependencyResolverFactoryTest.cs index 763d1b73..6044cd5a 100644 --- a/Sources/SqlDatabase.PowerShell.Test/Internal/DependencyResolverFactoryTest.cs +++ b/Sources/SqlDatabase.PowerShell.Test/Internal/DependencyResolverFactoryTest.cs @@ -12,7 +12,7 @@ public class DependencyResolverFactoryTest [TestCase("Desktop", typeof(PowerShellDesktopDependencyResolver))] [TestCase(null, typeof(PowerShellDesktopDependencyResolver))] [TestCase("Core", typeof(PowerShellCoreDependencyResolver))] - public void CreateProgram(string psEdition, Type expected) + public void CreateProgram(string? psEdition, Type expected) { var psVersionTable = new Hashtable(); if (psEdition != null) diff --git a/Sources/SqlDatabase.PowerShell.Test/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.PowerShell.Test/Properties/AssemblyInfo.cs index 7a516c57..5f282702 100644 --- a/Sources/SqlDatabase.PowerShell.Test/Properties/AssemblyInfo.cs +++ b/Sources/SqlDatabase.PowerShell.Test/Properties/AssemblyInfo.cs @@ -1,6 +1 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SqlDatabase.PowerShell.Test")] -[assembly: AssemblyDescription("")] -[assembly: Guid("26DEB773-3811-4AA9-897C-A2A700923F7A")] + \ No newline at end of file diff --git a/Sources/SqlDatabase.PowerShell.Test/SqlDatabase.PowerShell.Test.csproj b/Sources/SqlDatabase.PowerShell.Test/SqlDatabase.PowerShell.Test.csproj index 9917b25d..eaf7fcb4 100644 --- a/Sources/SqlDatabase.PowerShell.Test/SqlDatabase.PowerShell.Test.csproj +++ b/Sources/SqlDatabase.PowerShell.Test/SqlDatabase.PowerShell.Test.csproj @@ -3,23 +3,18 @@ net472 SqlDatabase.PowerShell - ..\..\bin\Tests - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + + + diff --git a/Sources/SqlDatabase.PowerShell.Test/TestApi/SqlDatabaseCmdLetTest.cs b/Sources/SqlDatabase.PowerShell.Test/TestApi/SqlDatabaseCmdLetTest.cs index 7c3e756b..a66d3177 100644 --- a/Sources/SqlDatabase.PowerShell.Test/TestApi/SqlDatabaseCmdLetTest.cs +++ b/Sources/SqlDatabase.PowerShell.Test/TestApi/SqlDatabaseCmdLetTest.cs @@ -10,6 +10,7 @@ using Shouldly; using SqlDatabase.Configuration; using SqlDatabase.PowerShell.Internal; +using SqlDatabase.TestApi; using Command = System.Management.Automation.Runspaces.Command; namespace SqlDatabase.PowerShell.TestApi; @@ -17,8 +18,8 @@ namespace SqlDatabase.PowerShell.TestApi; public abstract class SqlDatabaseCmdLetTest { private readonly IList _commandLines = new List(); - private Runspace _runSpace; - private System.Management.Automation.PowerShell _powerShell; + private Runspace _runSpace = null!; + private System.Management.Automation.PowerShell _powerShell = null!; [SetUp] public void BeforeEachTest() @@ -52,7 +53,7 @@ public void AfterEachTest() foreach (var row in _powerShell.Streams.Information) { - Console.WriteLine(row); + TestOutput.WriteLine(row); } _powerShell?.Dispose(); @@ -90,7 +91,7 @@ private static IEnumerable ResolveAliases() var cmdlet = (CmdletAttribute)typeof(TSubject).GetCustomAttribute(typeof(CmdletAttribute)); cmdlet.ShouldNotBeNull(); - yield return "{0}-{1}".FormatWith(cmdlet.VerbName, cmdlet.NounName); + yield return $"{cmdlet.VerbName}-{cmdlet.NounName}"; var alias = (AliasAttribute)typeof(TSubject).GetCustomAttribute(typeof(AliasAttribute)); if (alias != null) diff --git a/Sources/SqlDatabase.PowerShell/CreateCmdLet.cs b/Sources/SqlDatabase.PowerShell/CreateCmdLet.cs index f66c2d0b..4051027b 100644 --- a/Sources/SqlDatabase.PowerShell/CreateCmdLet.cs +++ b/Sources/SqlDatabase.PowerShell/CreateCmdLet.cs @@ -10,25 +10,25 @@ public sealed class CreateCmdLet : PSCmdlet { [Parameter(Mandatory = true, Position = 1, HelpMessage = "Connection string to target database.")] [Alias("d")] - public string Database { get; set; } + public string Database { get; set; } = null!; [Parameter(Mandatory = true, Position = 2, ValueFromPipeline = true, HelpMessage = "A path to a folder or zip archive with sql scripts or path to a sql script file. Repeat -from to setup several sources.")] [Alias("f")] - public string[] From { get; set; } + public string[] From { get; set; } = null!; [Parameter(Position = 3, HelpMessage = "A path to application configuration file. Default is current SqlDatabase.exe.config.")] [Alias("c")] - public string Configuration { get; set; } + public string? Configuration { get; set; } [Parameter(Position = 4, HelpMessage = "Shows what would happen if the command runs. The command is not run.")] public SwitchParameter WhatIf { get; set; } [Parameter(ValueFromRemainingArguments = true, HelpMessage = "Set a variable in format \"[name of variable]=[value of variable]\".")] [Alias("v")] - public string[] Var { get; set; } + public string[]? Var { get; set; } [Parameter(HelpMessage = "Optional path to log file.")] - public string Log { get; set; } + public string? Log { get; set; } protected override void ProcessRecord() { diff --git a/Sources/SqlDatabase.PowerShell/ExecuteCmdLet.cs b/Sources/SqlDatabase.PowerShell/ExecuteCmdLet.cs index 0dcba5bd..a2bdcc8a 100644 --- a/Sources/SqlDatabase.PowerShell/ExecuteCmdLet.cs +++ b/Sources/SqlDatabase.PowerShell/ExecuteCmdLet.cs @@ -10,15 +10,15 @@ public sealed class ExecuteCmdLet : PSCmdlet { [Parameter(Mandatory = true, Position = 1, HelpMessage = "Connection string to target database.")] [Alias("d")] - public string Database { get; set; } + public string Database { get; set; } = null!; [Parameter(Position = 2, ValueFromPipeline = true, HelpMessage = "A path to a folder or zip archive with sql scripts or path to a sql script file. Repeat -from to setup several sources.")] [Alias("f")] - public string[] From { get; set; } + public string[]? From { get; set; } [Parameter(HelpMessage = "An sql script text. Repeat -fromSql to setup several scripts.")] [Alias("s")] - public string[] FromSql { get; set; } + public string[]? FromSql { get; set; } [Parameter(Position = 3, HelpMessage = "Transaction mode. Possible values: none, perStep. Default is none.")] [Alias("t")] @@ -26,17 +26,17 @@ public sealed class ExecuteCmdLet : PSCmdlet [Parameter(Position = 4, HelpMessage = "A path to application configuration file. Default is current SqlDatabase.exe.config.")] [Alias("c")] - public string Configuration { get; set; } + public string? Configuration { get; set; } [Parameter(Position = 5, HelpMessage = "Shows what would happen if the command runs. The command is not run.")] public SwitchParameter WhatIf { get; set; } [Parameter(ValueFromRemainingArguments = true, HelpMessage = "Set a variable in format \"[name of variable]=[value of variable]\".")] [Alias("v")] - public string[] Var { get; set; } + public string[]? Var { get; set; } [Parameter(HelpMessage = "Optional path to log file.")] - public string Log { get; set; } + public string? Log { get; set; } protected override void ProcessRecord() { diff --git a/Sources/SqlDatabase.PowerShell/ExportCmdLet.cs b/Sources/SqlDatabase.PowerShell/ExportCmdLet.cs index 78a37db8..e3b2d386 100644 --- a/Sources/SqlDatabase.PowerShell/ExportCmdLet.cs +++ b/Sources/SqlDatabase.PowerShell/ExportCmdLet.cs @@ -8,32 +8,32 @@ public sealed class ExportCmdLet : PSCmdlet { [Parameter(Mandatory = true, Position = 1, HelpMessage = "Connection string to target database.")] [Alias("d")] - public string Database { get; set; } + public string Database { get; set; } = null!; [Parameter(Position = 2, HelpMessage = "An sql script to select export data. Repeat -fromSql to setup several scripts.")] [Alias("s")] - public string[] FromSql { get; set; } + public string[]? FromSql { get; set; } [Parameter(HelpMessage = "A path to a folder or zip archive with sql scripts or path to a sql script file. Repeat -from to setup several sources.")] [Alias("f")] - public string[] From { get; set; } + public string[]? From { get; set; } [Parameter(Position = 3, HelpMessage = "Write sql scripts into a file. By default write into information stream.")] - public string ToFile { get; set; } + public string? ToFile { get; set; } [Parameter(Position = 4, HelpMessage = "A path to application configuration file. Default is current SqlDatabase.exe.config.")] [Alias("c")] - public string Configuration { get; set; } + public string? Configuration { get; set; } [Parameter(HelpMessage = "Setup \"INSERT INTO\" table name. Default is dbo.SqlDatabaseExport.")] - public string ToTable { get; set; } + public string? ToTable { get; set; } [Parameter(ValueFromRemainingArguments = true, HelpMessage = "Set a variable in format \"[name of variable]=[value of variable]\".")] [Alias("v")] - public string[] Var { get; set; } + public string[]? Var { get; set; } [Parameter(HelpMessage = "Optional path to log file.")] - public string Log { get; set; } + public string? Log { get; set; } protected override void ProcessRecord() { diff --git a/Sources/SqlDatabase.PowerShell/Internal/AssemblyCache.cs b/Sources/SqlDatabase.PowerShell/Internal/AssemblyCache.cs index 53fb0f2c..5287de6d 100644 --- a/Sources/SqlDatabase.PowerShell/Internal/AssemblyCache.cs +++ b/Sources/SqlDatabase.PowerShell/Internal/AssemblyCache.cs @@ -8,7 +8,7 @@ namespace SqlDatabase.PowerShell.Internal; internal sealed class AssemblyCache : IDisposable { private readonly string[] _probingPaths; - private readonly IDictionary _assemblyByName; + private readonly IDictionary _assemblyByName; public AssemblyCache(params string[] probingPaths) { @@ -19,10 +19,10 @@ public AssemblyCache(params string[] probingPaths) _probingPaths[i + 1] = probingPaths[i]; } - _assemblyByName = new Dictionary(StringComparer.OrdinalIgnoreCase); + _assemblyByName = new Dictionary(StringComparer.OrdinalIgnoreCase); } - public Assembly Load(AssemblyName assemblyName, Func loader) + public Assembly? Load(AssemblyName assemblyName, Func loader) { var fileName = assemblyName.Name + ".dll"; if (_assemblyByName.TryGetValue(fileName, out var assembly)) @@ -40,7 +40,7 @@ public void Dispose() _assemblyByName.Clear(); } - private Assembly TryFindAndLoad(string fileName, Func loader) + private Assembly? TryFindAndLoad(string fileName, Func loader) { for (var i = 0; i < _probingPaths.Length; i++) { diff --git a/Sources/SqlDatabase.PowerShell/Internal/CmdletExtensions.cs b/Sources/SqlDatabase.PowerShell/Internal/CmdletExtensions.cs index 66c48a99..75019134 100644 --- a/Sources/SqlDatabase.PowerShell/Internal/CmdletExtensions.cs +++ b/Sources/SqlDatabase.PowerShell/Internal/CmdletExtensions.cs @@ -17,7 +17,7 @@ public static string GetWorkingDirectory(this PSCmdlet cmdlet) return root; } - public static string RootPath(this PSCmdlet cmdlet, string path) + public static string? RootPath(this PSCmdlet cmdlet, string? path) { if (string.IsNullOrEmpty(path) || Path.IsPathRooted(path)) { @@ -40,13 +40,19 @@ public static bool TryGetPSVersionTable(this PSCmdlet cmdlet, out PSVersionTable return true; } - public static void AppendFrom(this PSCmdlet cmdlet, string[] from, GenericCommandLineBuilder target) + public static void AppendFrom(this PSCmdlet cmdlet, string[]? from, GenericCommandLineBuilder target) { - if (from != null) + if (from == null) { - for (var i = 0; i < from.Length; i++) + return; + } + + for (var i = 0; i < from.Length; i++) + { + var path = cmdlet.RootPath(from[i]); + if (path != null) { - target.SetScripts(cmdlet.RootPath(from[i])); + target.SetScripts(path); } } } diff --git a/Sources/SqlDatabase.PowerShell/Internal/PSVersionTable.cs b/Sources/SqlDatabase.PowerShell/Internal/PSVersionTable.cs index 4c44dbb2..051dfd21 100644 --- a/Sources/SqlDatabase.PowerShell/Internal/PSVersionTable.cs +++ b/Sources/SqlDatabase.PowerShell/Internal/PSVersionTable.cs @@ -26,7 +26,7 @@ public PSVersionTable(object value) } } - public string PSEdition { get; } + public string? PSEdition { get; } - public string PSVersion { get; } + public string? PSVersion { get; } } \ No newline at end of file diff --git a/Sources/SqlDatabase.PowerShell/Internal/PowerShellCommandBase.cs b/Sources/SqlDatabase.PowerShell/Internal/PowerShellCommandBase.cs index 9b54c92f..9bfb5f80 100644 --- a/Sources/SqlDatabase.PowerShell/Internal/PowerShellCommandBase.cs +++ b/Sources/SqlDatabase.PowerShell/Internal/PowerShellCommandBase.cs @@ -14,7 +14,7 @@ protected PowerShellCommandBase(PSCmdlet cmdlet) public PSCmdlet Cmdlet { get; } // only for tests - internal static ISqlDatabaseProgram Program { get; set; } + internal static ISqlDatabaseProgram? Program { get; set; } public void Execute() { diff --git a/Sources/SqlDatabase.PowerShell/Internal/PowerShellCoreDependencyResolver.cs b/Sources/SqlDatabase.PowerShell/Internal/PowerShellCoreDependencyResolver.cs index 72ef5288..5a8bdd60 100644 --- a/Sources/SqlDatabase.PowerShell/Internal/PowerShellCoreDependencyResolver.cs +++ b/Sources/SqlDatabase.PowerShell/Internal/PowerShellCoreDependencyResolver.cs @@ -30,7 +30,7 @@ public void Dispose() _cache.Dispose(); } - private Assembly AssemblyResolving(AssemblyLoadContext context, AssemblyName assemblyName) + private Assembly? AssemblyResolving(AssemblyLoadContext context, AssemblyName assemblyName) { return _cache.Load(assemblyName, context.LoadFromAssemblyPath); } diff --git a/Sources/SqlDatabase.PowerShell/Internal/PowerShellDesktopDependencyResolver.cs b/Sources/SqlDatabase.PowerShell/Internal/PowerShellDesktopDependencyResolver.cs index 80a295b2..9e033675 100644 --- a/Sources/SqlDatabase.PowerShell/Internal/PowerShellDesktopDependencyResolver.cs +++ b/Sources/SqlDatabase.PowerShell/Internal/PowerShellDesktopDependencyResolver.cs @@ -25,7 +25,7 @@ public void Dispose() _cache.Dispose(); } - private Assembly AssemblyResolve(object sender, ResolveEventArgs args) + private Assembly? AssemblyResolve(object sender, ResolveEventArgs args) { return _cache.Load(new AssemblyName(args.Name), Assembly.LoadFrom); } diff --git a/Sources/SqlDatabase.PowerShell/Internal/SqlDatabaseProgram.cs b/Sources/SqlDatabase.PowerShell/Internal/SqlDatabaseProgram.cs index 693a0c28..0dba068e 100644 --- a/Sources/SqlDatabase.PowerShell/Internal/SqlDatabaseProgram.cs +++ b/Sources/SqlDatabase.PowerShell/Internal/SqlDatabaseProgram.cs @@ -1,4 +1,5 @@ -using SqlDatabase.Configuration; +using SqlDatabase.Adapter; +using SqlDatabase.Configuration; namespace SqlDatabase.PowerShell.Internal; diff --git a/Sources/SqlDatabase.PowerShell/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.PowerShell/Properties/AssemblyInfo.cs index 94a20fc0..5a6f68ea 100644 --- a/Sources/SqlDatabase.PowerShell/Properties/AssemblyInfo.cs +++ b/Sources/SqlDatabase.PowerShell/Properties/AssemblyInfo.cs @@ -1,8 +1,4 @@ -using System.Reflection; using System.Runtime.CompilerServices; -[assembly: AssemblyTitle("SqlDatabase.PowerShell")] -[assembly: AssemblyDescription("")] - [assembly: InternalsVisibleTo("SqlDatabase.PowerShell.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase.PowerShell/SqlDatabase.PowerShell.csproj b/Sources/SqlDatabase.PowerShell/SqlDatabase.PowerShell.csproj index bbd43a6f..a7bdf37c 100644 --- a/Sources/SqlDatabase.PowerShell/SqlDatabase.PowerShell.csproj +++ b/Sources/SqlDatabase.PowerShell/SqlDatabase.PowerShell.csproj @@ -7,7 +7,7 @@ - + @@ -25,16 +25,15 @@ - - - - + + - - - - - + + + + + + diff --git a/Sources/SqlDatabase.PowerShell/SqlDatabase.psd1 b/Sources/SqlDatabase.PowerShell/SqlDatabase.psd1 index fc662ee3..8bf15a68 100644 Binary files a/Sources/SqlDatabase.PowerShell/SqlDatabase.psd1 and b/Sources/SqlDatabase.PowerShell/SqlDatabase.psd1 differ diff --git a/Sources/SqlDatabase.PowerShell/UpgradeCmdLet.cs b/Sources/SqlDatabase.PowerShell/UpgradeCmdLet.cs index 95b921ff..1080221f 100644 --- a/Sources/SqlDatabase.PowerShell/UpgradeCmdLet.cs +++ b/Sources/SqlDatabase.PowerShell/UpgradeCmdLet.cs @@ -10,11 +10,11 @@ public sealed class UpgradeCmdLet : PSCmdlet { [Parameter(Mandatory = true, Position = 1, HelpMessage = "Connection string to target database.")] [Alias("d")] - public string Database { get; set; } + public string Database { get; set; } = null!; [Parameter(Mandatory = true, Position = 2, ValueFromPipeline = true, HelpMessage = "A path to a folder or zip archive with migration steps. Repeat -from to setup several sources.")] [Alias("f")] - public string[] From { get; set; } + public string[]? From { get; set; } [Parameter(Position = 3, HelpMessage = "Transaction mode. Possible values: none, perStep. Default is none.")] [Alias("t")] @@ -22,7 +22,7 @@ public sealed class UpgradeCmdLet : PSCmdlet [Parameter(Position = 4, HelpMessage = "A path to application configuration file. Default is current SqlDatabase.exe.config.")] [Alias("c")] - public string Configuration { get; set; } + public string? Configuration { get; set; } [Parameter(Position = 5, HelpMessage = "Shows what would happen if the command runs. The command is not run.")] public SwitchParameter WhatIf { get; set; } @@ -32,10 +32,10 @@ public sealed class UpgradeCmdLet : PSCmdlet [Parameter(ValueFromRemainingArguments = true, HelpMessage = "Set a variable in format \"[name of variable]=[value of variable]\".")] [Alias("v")] - public string[] Var { get; set; } + public string[]? Var { get; set; } [Parameter(HelpMessage = "Optional path to log file.")] - public string Log { get; set; } + public string? Log { get; set; } protected override void ProcessRecord() { diff --git a/Sources/SqlDatabase.Test/Scripts/CreateScriptSequenceTest.cs b/Sources/SqlDatabase.Sequence.Test/CreateScriptSequenceTest.cs similarity index 74% rename from Sources/SqlDatabase.Test/Scripts/CreateScriptSequenceTest.cs rename to Sources/SqlDatabase.Sequence.Test/CreateScriptSequenceTest.cs index c280e843..1bcf819f 100644 --- a/Sources/SqlDatabase.Test/Scripts/CreateScriptSequenceTest.cs +++ b/Sources/SqlDatabase.Sequence.Test/CreateScriptSequenceTest.cs @@ -1,24 +1,25 @@ -using System.IO; +using System.Collections.Generic; using System.Linq; using Moq; using NUnit.Framework; -using SqlDatabase.IO; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; [TestFixture] public class CreateScriptSequenceTest { - private CreateScriptSequence _sut; + private CreateScriptSequence _sut = null!; [SetUp] public void BeforeEachTest() { var scriptFactory = new Mock(MockBehavior.Strict); scriptFactory - .Setup(f => f.IsSupported(It.IsAny())) - .Returns(s => ".sql".Equals(Path.GetExtension(s)) || ".exe".Equals(Path.GetExtension(s))); + .Setup(f => f.IsSupported(It.IsAny())) + .Returns(f => ".sql".Equals(f.Extension) || ".exe".Equals(f.Extension)); scriptFactory .Setup(s => s.FromFile(It.IsNotNull())) @@ -30,10 +31,7 @@ public void BeforeEachTest() return script.Object; }); - _sut = new CreateScriptSequence - { - ScriptFactory = scriptFactory.Object - }; + _sut = new CreateScriptSequence(new List(), scriptFactory.Object); } [Test] @@ -68,7 +66,7 @@ public void BuildSequenceFromOneFolder() .Concat(files) .ToArray(); - _sut.Sources = new IFileSystemInfo[] { FileFactory.Folder("root", content) }; + _sut.Sources.Add(FileFactory.Folder("root", content)); var actual = _sut.BuildSequence(); @@ -89,13 +87,10 @@ public void BuildSequenceFromOneFolder() [Test] public void BuildSequenceFromFolderAndFile() { - _sut.Sources = new IFileSystemInfo[] - { - FileFactory.Folder("root", FileFactory.File("20.sql"), FileFactory.File("10.sql")), - FileFactory.File("02.sql"), - FileFactory.File("01.sql"), - FileFactory.File("ignore") - }; + _sut.Sources.Add(FileFactory.Folder("root", FileFactory.File("20.sql"), FileFactory.File("10.sql"))); + _sut.Sources.Add(FileFactory.File("02.sql")); + _sut.Sources.Add(FileFactory.File("01.sql")); + _sut.Sources.Add(FileFactory.File("ignore")); var actual = _sut.BuildSequence(); diff --git a/Sources/SqlDatabase.Test/Scripts/DependencyParserTest.cs b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest.cs similarity index 81% rename from Sources/SqlDatabase.Test/Scripts/DependencyParserTest.cs rename to Sources/SqlDatabase.Sequence.Test/DependencyParserTest.cs index c86dd3e5..6fa611ba 100644 --- a/Sources/SqlDatabase.Test/Scripts/DependencyParserTest.cs +++ b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest.cs @@ -4,19 +4,19 @@ using System.Linq; using NUnit.Framework; using Shouldly; -using SqlDatabase.Scripts.SqlTestCases; +using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; [TestFixture] public class DependencyParserTest { [Test] [TestCaseSource(nameof(GetExtractDependenciesTestCases))] - public void ExtractDependencies(string sql, ScriptDependency[] expected) + public void ExtractDependencies(string sql, Array expected) { var actual = DependencyParser.ExtractDependencies(new StringReader(sql), "file name").ToArray(); - actual.ShouldBe(expected); + actual.ShouldBe((ScriptDependency[])expected); } [Test] @@ -27,13 +27,13 @@ public void ExtractDependenciesInvalidVersion(string versionText) var input = "-- module dependency: moduleName " + versionText; var ex = Assert.Throws(() => DependencyParser.ExtractDependencies(new StringReader(input), "file name").ToArray()); - ex.Message.ShouldContain("moduleName"); + ex!.Message.ShouldContain("moduleName"); ex.Message.ShouldContain(versionText); } private static IEnumerable GetExtractDependenciesTestCases() { - foreach (var testCase in ResourceReader.Read("Dependencies")) + foreach (var testCase in ResourceReader.Read(typeof(DependencyParserTest).Assembly, nameof(DependencyParserTest))) { var expected = new List(); foreach (var line in testCase.Expected) diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case01.sql b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case01.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case01.sql rename to Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case01.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case02.sql b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case02.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case02.sql rename to Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case02.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case03.sql b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case03.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case03.sql rename to Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case03.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case04.sql b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case04.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case04.sql rename to Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case04.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case05.sql b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case05.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Case05.sql rename to Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Case05.sql diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Empty.sql b/Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Empty.sql similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/Dependencies/Empty.sql rename to Sources/SqlDatabase.Sequence.Test/DependencyParserTest/Empty.sql diff --git a/Sources/SqlDatabase.Test/Scripts/UpgradeInternal/ModuleVersionResolverTest.cs b/Sources/SqlDatabase.Sequence.Test/ModuleVersionResolverTest.cs similarity index 62% rename from Sources/SqlDatabase.Test/Scripts/UpgradeInternal/ModuleVersionResolverTest.cs rename to Sources/SqlDatabase.Sequence.Test/ModuleVersionResolverTest.cs index bf74b9d9..90ae5268 100644 --- a/Sources/SqlDatabase.Test/Scripts/UpgradeInternal/ModuleVersionResolverTest.cs +++ b/Sources/SqlDatabase.Sequence.Test/ModuleVersionResolverTest.cs @@ -3,36 +3,31 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; +using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts.UpgradeInternal; +namespace SqlDatabase.Sequence; [TestFixture] public class ModuleVersionResolverTest { - private ModuleVersionResolver _sut; - private Mock _database; - private IList _logOutput; + private ModuleVersionResolver _sut = null!; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() { - _database = new Mock(MockBehavior.Strict); - _logOutput = new List(); var log = new Mock(MockBehavior.Strict); log .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); - _sut = new ModuleVersionResolver - { - Database = _database.Object, - Log = log.Object - }; + _sut = new ModuleVersionResolver(log.Object, null!); } [Test] @@ -41,13 +36,14 @@ public void GetCurrentVersionModuleName() const string ModuleName = "the-module"; var moduleVersion = new Version("1.0"); - _database - .Setup(d => d.GetCurrentVersion(ModuleName)) - .Returns(moduleVersion); + _sut.Database = name => + { + name.ShouldBe(ModuleName); + return moduleVersion; + }; _sut.GetCurrentVersion(ModuleName).ShouldBe(moduleVersion); - _database.VerifyAll(); _logOutput.Count.ShouldBe(1); _logOutput[0].ShouldContain(ModuleName); _logOutput[0].ShouldContain(moduleVersion.ToString()); @@ -58,13 +54,14 @@ public void GetCurrentVersionNoModule() { var version = new Version("1.0"); - _database - .Setup(d => d.GetCurrentVersion(string.Empty)) - .Returns(version); + _sut.Database = name => + { + name.ShouldBeEmpty(); + return version; + }; _sut.GetCurrentVersion(null).ShouldBe(version); - _database.VerifyAll(); _logOutput.Count.ShouldBe(1); _logOutput[0].ShouldContain("database version"); _logOutput[0].ShouldContain(version.ToString()); @@ -75,16 +72,20 @@ public void GetCurrentVersionCache() { var version = new Version("1.0"); - _database - .Setup(d => d.GetCurrentVersion(string.Empty)) - .Returns(new Version("1.0")); + _sut.Database = name => + { + name.ShouldBeEmpty(); + return version; + }; _sut.GetCurrentVersion(null).ShouldBe(version); _logOutput.Clear(); - _database - .Setup(d => d.GetCurrentVersion(string.Empty)) - .Throws(); + _sut.Database = name => + { + name.ShouldBeEmpty(); + throw new NotSupportedException(); + }; _sut.GetCurrentVersion(null).ShouldBe(version); _logOutput.ShouldBeEmpty(); diff --git a/Sources/SqlDatabase.Sequence.Test/SqlDatabase.Sequence.Test.csproj b/Sources/SqlDatabase.Sequence.Test/SqlDatabase.Sequence.Test.csproj new file mode 100644 index 00000000..2fcaebb2 --- /dev/null +++ b/Sources/SqlDatabase.Sequence.Test/SqlDatabase.Sequence.Test.csproj @@ -0,0 +1,24 @@ + + + + net472;net6.0;net7.0;net8.0 + SqlDatabase.Sequence + + + + + + + + + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/Scripts/UpgradeInternal/UpgradeScriptCollectionTest.cs b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptCollectionTest.cs similarity index 86% rename from Sources/SqlDatabase.Test/Scripts/UpgradeInternal/UpgradeScriptCollectionTest.cs rename to Sources/SqlDatabase.Sequence.Test/UpgradeScriptCollectionTest.cs index 838fc35a..031f5fcc 100644 --- a/Sources/SqlDatabase.Test/Scripts/UpgradeInternal/UpgradeScriptCollectionTest.cs +++ b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptCollectionTest.cs @@ -2,7 +2,7 @@ using NUnit.Framework; using Shouldly; -namespace SqlDatabase.Scripts.UpgradeInternal; +namespace SqlDatabase.Sequence; [TestFixture] public class UpgradeScriptCollectionTest @@ -20,7 +20,7 @@ public class UpgradeScriptCollectionTest [TestCase("1.0_xxx.sql", null, null, null)] [TestCase("2.0_1.0.sql", null, null, null)] [TestCase("_1.0_1.1.sql", null, null, null)] - public void TryParseFileName(string name, string moduleName, string from, string to) + public void TryParseFileName(string name, string? moduleName, string? from, string? to) { var actual = UpgradeScriptCollection.TryParseFileName(name, out var actualModuleName, out var actualFrom, out var actualTo); @@ -33,7 +33,7 @@ public void TryParseFileName(string name, string moduleName, string from, string actual.ShouldBeTrue(); actualModuleName.ShouldBe(moduleName); actualFrom.ShouldBe(new Version(from)); - actualTo.ShouldBe(new Version(to)); + actualTo.ShouldBe(new Version(to!)); } } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest.cs b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest.cs similarity index 72% rename from Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest.cs rename to Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest.cs index 401f0ddd..f88189d9 100644 --- a/Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest.cs +++ b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest.cs @@ -6,19 +6,19 @@ using Newtonsoft.Json; using NUnit.Framework; using Shouldly; -using SqlDatabase.IO; -using SqlDatabase.Scripts.UpgradeInternal; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; using SqlDatabase.TestApi; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; [TestFixture] public class UpgradeScriptSequenceTest { - private UpgradeScriptSequence _sut; - private SourceFolder _root; - private Mock _versionResolver; - private Mock _scriptFactory; + private UpgradeScriptSequence _sut = null!; + private SourceFolder _root = null!; + private Mock _versionResolver = null!; + private Mock _scriptFactory = null!; [SetUp] public void BeforeEachTest() @@ -27,17 +27,18 @@ public void BeforeEachTest() _scriptFactory = new Mock(MockBehavior.Strict); _scriptFactory - .Setup(f => f.IsSupported(It.IsAny())) - .Returns(s => ".sql".Equals(Path.GetExtension(s)) || ".exe".Equals(Path.GetExtension(s))); + .Setup(f => f.IsSupported(It.IsAny())) + .Returns(f => ".sql".Equals(f.Extension) || ".exe".Equals(f.Extension)); _versionResolver = new Mock(MockBehavior.Strict); - _sut = new UpgradeScriptSequence - { - Sources = { _root }, - ScriptFactory = _scriptFactory.Object, - VersionResolver = _versionResolver.Object - }; + _sut = new UpgradeScriptSequence( + _scriptFactory.Object, + _versionResolver.Object, + new IFileSystemInfo[] { _root }, + new Mock(MockBehavior.Strict).Object, + false, + false); } [Test] @@ -48,15 +49,21 @@ public void BuildSequence(BuildSequenceCase testCase) { var file = AddFile(_root, sourceFile.Name); - var dependencies = new ScriptDependency[0]; - if (sourceFile.Dependencies != null) + var script = new Mock(MockBehavior.Strict); + script.SetupGet(s => s.DisplayName).Returns(file.Name); + + if (sourceFile.Dependencies == null) { - dependencies = sourceFile.Dependencies.Select(i => new ScriptDependency(i.Module, new Version(i.Version))).ToArray(); + script.Setup(s => s.GetDependencies()).Returns((TextReader?)null); } + else + { + var dependenciesText = string.Join( + Environment.NewLine, + sourceFile.Dependencies.Select(i => $"-- module dependency: {i.Module} {i.Version}")); - var script = new Mock(MockBehavior.Strict); - script.SetupGet(s => s.DisplayName).Returns(file.Name); - script.Setup(s => s.GetDependencies()).Returns(dependencies); + script.Setup(s => s.GetDependencies()).Returns(new StringReader(dependenciesText)); + } _scriptFactory .Setup(s => s.FromFile(file)) @@ -80,7 +87,7 @@ public void BuildSequence(BuildSequenceCase testCase) else { var ex = Assert.Throws(() => _sut.BuildSequence()); - Console.WriteLine(ex.Message); + TestOutput.WriteLine(ex!.Message); foreach (var tag in testCase.Exception) { ex.Message.ShouldContain(tag); @@ -103,9 +110,9 @@ private static IEnumerable GetBuildSequence() { BuildSequenceCase[] testCases; using (var stream = anchor.Assembly.GetManifestResourceStream(sourceName)) - using (var reader = new JsonTextReader(new StreamReader(stream))) + using (var reader = new JsonTextReader(new StreamReader(stream!))) { - testCases = new JsonSerializer().Deserialize(reader); + testCases = new JsonSerializer().Deserialize(reader)!; } foreach (var testCase in testCases) @@ -131,31 +138,31 @@ private static IFile AddFile(SourceFolder root, string fileName) public sealed class BuildSequenceCase { - public string Name { get; set; } + public string Name { get; set; } = null!; public bool FolderAsModuleName { get; set; } - public ModuleVersion[] Version { get; set; } + public ModuleVersion[] Version { get; set; } = null!; - public SourceFile[] Files { get; set; } + public SourceFile[] Files { get; set; } = null!; - public string[] Sequence { get; set; } + public string[] Sequence { get; set; } = null!; - public string[] Exception { get; set; } + public string[]? Exception { get; set; } } public sealed class ModuleVersion { - public string Module { get; set; } + public string Module { get; set; } = null!; - public string Version { get; set; } + public string Version { get; set; } = null!; } public sealed class SourceFile { - public string Name { get; set; } + public string Name { get; set; } = null!; - public ModuleVersion[] Dependencies { get; set; } + public ModuleVersion[]? Dependencies { get; set; } } private sealed class SourceFolder : IFolder diff --git a/Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/FolderAsModuleName.json b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/FolderAsModuleName.json similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/FolderAsModuleName.json rename to Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/FolderAsModuleName.json diff --git a/Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/OneModule.json b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/OneModule.json similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/OneModule.json rename to Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/OneModule.json diff --git a/Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/ThreeModules.json b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/ThreeModules.json similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/ThreeModules.json rename to Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/ThreeModules.json diff --git a/Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/TwoModules.json b/Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/TwoModules.json similarity index 100% rename from Sources/SqlDatabase.Test/Scripts/UpgradeScriptSequenceTest/TwoModules.json rename to Sources/SqlDatabase.Sequence.Test/UpgradeScriptSequenceTest/TwoModules.json diff --git a/Sources/SqlDatabase.Sequence/CodeAnalysis/AllowNullAttribute.cs b/Sources/SqlDatabase.Sequence/CodeAnalysis/AllowNullAttribute.cs new file mode 100644 index 00000000..39be8db8 --- /dev/null +++ b/Sources/SqlDatabase.Sequence/CodeAnalysis/AllowNullAttribute.cs @@ -0,0 +1,8 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] +internal sealed class AllowNullAttribute : Attribute +{ +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Sequence/CodeAnalysis/NotNullWhenAttribute.cs b/Sources/SqlDatabase.Sequence/CodeAnalysis/NotNullWhenAttribute.cs new file mode 100644 index 00000000..e3d56cf7 --- /dev/null +++ b/Sources/SqlDatabase.Sequence/CodeAnalysis/NotNullWhenAttribute.cs @@ -0,0 +1,10 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +internal sealed class NotNullWhenAttribute : Attribute +{ + public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; + + public bool ReturnValue { get; } +} +#endif diff --git a/Sources/SqlDatabase/Scripts/CreateScriptSequence.cs b/Sources/SqlDatabase.Sequence/CreateScriptSequence.cs similarity index 64% rename from Sources/SqlDatabase/Scripts/CreateScriptSequence.cs rename to Sources/SqlDatabase.Sequence/CreateScriptSequence.cs index fc7bea44..826f0e89 100644 --- a/Sources/SqlDatabase/Scripts/CreateScriptSequence.cs +++ b/Sources/SqlDatabase.Sequence/CreateScriptSequence.cs @@ -1,15 +1,22 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using SqlDatabase.IO; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; -internal sealed class CreateScriptSequence : ICreateScriptSequence +public sealed class CreateScriptSequence : ICreateScriptSequence { - public IList Sources { get; set; } + public CreateScriptSequence(IList sources, IScriptFactory scriptFactory) + { + Sources = sources; + ScriptFactory = scriptFactory; + } + + public IList Sources { get; } - public IScriptFactory ScriptFactory { get; set; } + public IScriptFactory ScriptFactory { get; } public IList BuildSequence() { @@ -21,9 +28,9 @@ public IList BuildSequence() { Build(folder, null, ScriptFactory, result); } - else if (ScriptFactory.IsSupported(source.Name)) + else if ((source is IFile file) && ScriptFactory.IsSupported(file)) { - result.Add(ScriptFactory.FromFile((IFile)source)); + result.Add(ScriptFactory.FromFile(file)); } } @@ -32,7 +39,7 @@ public IList BuildSequence() private static void Build( IFolder root, - string fullPath, + string? fullPath, IScriptFactory factory, List scripts) { @@ -40,7 +47,7 @@ private static void Build( var files = root .GetFiles() - .Where(i => factory.IsSupported(i.Name)) + .Where(factory.IsSupported) .OrderBy(i => i.Name) .Select(factory.FromFile); diff --git a/Sources/SqlDatabase/Scripts/DependencyParser.cs b/Sources/SqlDatabase.Sequence/DependencyParser.cs similarity index 72% rename from Sources/SqlDatabase/Scripts/DependencyParser.cs rename to Sources/SqlDatabase.Sequence/DependencyParser.cs index 4161bead..e96db1e8 100644 --- a/Sources/SqlDatabase/Scripts/DependencyParser.cs +++ b/Sources/SqlDatabase.Sequence/DependencyParser.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; -using System.Text; using System.Text.RegularExpressions; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; internal static class DependencyParser { @@ -12,14 +12,14 @@ internal static class DependencyParser public static IEnumerable ExtractDependencies(TextReader reader, string scriptName) { - string line; + string? line; while ((line = reader.ReadLine()) != null) { if (TryParseDependencyLine(line, out var moduleName, out var versionText)) { if (!Version.TryParse(versionText, out var version)) { - throw new InvalidOperationException("The current version value [{0}] of module [{1}] is invalid, script {2}.".FormatWith(versionText, moduleName, scriptName)); + throw new InvalidOperationException($"The current version value [{versionText}] of module [{moduleName}] is invalid, script {scriptName}."); } yield return new ScriptDependency(moduleName, version); @@ -27,7 +27,10 @@ public static IEnumerable ExtractDependencies(TextReader reade } } - private static bool TryParseDependencyLine(string line, out string moduleName, out string version) + private static bool TryParseDependencyLine( + string line, + [NotNullWhen(true)] out string? moduleName, + [NotNullWhen(true)] out string? version) { moduleName = null; version = null; diff --git a/Sources/SqlDatabase.Sequence/GetDatabaseCurrentVersion.cs b/Sources/SqlDatabase.Sequence/GetDatabaseCurrentVersion.cs new file mode 100644 index 00000000..6f5fb245 --- /dev/null +++ b/Sources/SqlDatabase.Sequence/GetDatabaseCurrentVersion.cs @@ -0,0 +1,5 @@ +using System; + +namespace SqlDatabase.Sequence; + +public delegate Version GetDatabaseCurrentVersion(string? moduleName); \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/ICreateScriptSequence.cs b/Sources/SqlDatabase.Sequence/ICreateScriptSequence.cs similarity index 66% rename from Sources/SqlDatabase/Scripts/ICreateScriptSequence.cs rename to Sources/SqlDatabase.Sequence/ICreateScriptSequence.cs index 86ff0c0c..a2024e4f 100644 --- a/Sources/SqlDatabase/Scripts/ICreateScriptSequence.cs +++ b/Sources/SqlDatabase.Sequence/ICreateScriptSequence.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; +using SqlDatabase.Adapter; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; public interface ICreateScriptSequence { diff --git a/Sources/SqlDatabase/Scripts/UpgradeInternal/IModuleVersionResolver.cs b/Sources/SqlDatabase.Sequence/IModuleVersionResolver.cs similarity index 60% rename from Sources/SqlDatabase/Scripts/UpgradeInternal/IModuleVersionResolver.cs rename to Sources/SqlDatabase.Sequence/IModuleVersionResolver.cs index 0d656f96..6f863691 100644 --- a/Sources/SqlDatabase/Scripts/UpgradeInternal/IModuleVersionResolver.cs +++ b/Sources/SqlDatabase.Sequence/IModuleVersionResolver.cs @@ -1,9 +1,9 @@ using System; -namespace SqlDatabase.Scripts.UpgradeInternal; +namespace SqlDatabase.Sequence; internal interface IModuleVersionResolver { // => InvalidOperationException fail to determine dependent module [{1}] version - Version GetCurrentVersion(string moduleName); + Version GetCurrentVersion(string? moduleName); } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/IUpgradeScriptSequence.cs b/Sources/SqlDatabase.Sequence/IUpgradeScriptSequence.cs similarity index 79% rename from Sources/SqlDatabase/Scripts/IUpgradeScriptSequence.cs rename to Sources/SqlDatabase.Sequence/IUpgradeScriptSequence.cs index aad5a73d..333d30ee 100644 --- a/Sources/SqlDatabase/Scripts/IUpgradeScriptSequence.cs +++ b/Sources/SqlDatabase.Sequence/IUpgradeScriptSequence.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; public interface IUpgradeScriptSequence { diff --git a/Sources/SqlDatabase/Scripts/UpgradeInternal/ModuleVersionResolver.cs b/Sources/SqlDatabase.Sequence/ModuleVersionResolver.cs similarity index 59% rename from Sources/SqlDatabase/Scripts/UpgradeInternal/ModuleVersionResolver.cs rename to Sources/SqlDatabase.Sequence/ModuleVersionResolver.cs index 712d3fee..64bc845d 100644 --- a/Sources/SqlDatabase/Scripts/UpgradeInternal/ModuleVersionResolver.cs +++ b/Sources/SqlDatabase.Sequence/ModuleVersionResolver.cs @@ -1,17 +1,24 @@ using System; using System.Collections.Generic; +using SqlDatabase.Adapter; -namespace SqlDatabase.Scripts.UpgradeInternal; +namespace SqlDatabase.Sequence; internal sealed class ModuleVersionResolver : IModuleVersionResolver { private readonly IDictionary _versionByModule = new Dictionary(StringComparer.OrdinalIgnoreCase); - public ILogger Log { get; set; } + public ModuleVersionResolver(ILogger log, GetDatabaseCurrentVersion database) + { + Log = log; + Database = database; + } + + public ILogger Log { get; } - public IDatabase Database { get; set; } + public GetDatabaseCurrentVersion Database { get; internal set; } - public Version GetCurrentVersion(string moduleName) + public Version GetCurrentVersion(string? moduleName) { if (moduleName == null) { @@ -29,15 +36,15 @@ public Version GetCurrentVersion(string moduleName) private Version LoadVersion(string moduleName) { - var version = Database.GetCurrentVersion(moduleName); + var version = Database(moduleName); if (moduleName.Length == 0) { - Log.Info("database version: {0}".FormatWith(version)); + Log.Info($"database version: {version}"); } else { - Log.Info("module [{0}] version: {1}".FormatWith(moduleName, version)); + Log.Info($"module [{moduleName}] version: {version}"); } return version; diff --git a/Sources/SqlDatabase.Sequence/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Sequence/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..33420c3c --- /dev/null +++ b/Sources/SqlDatabase.Sequence/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SqlDatabase.Sequence.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/ScriptDependency.cs b/Sources/SqlDatabase.Sequence/ScriptDependency.cs similarity index 75% rename from Sources/SqlDatabase/Scripts/ScriptDependency.cs rename to Sources/SqlDatabase.Sequence/ScriptDependency.cs index 937f4daf..17704981 100644 --- a/Sources/SqlDatabase/Scripts/ScriptDependency.cs +++ b/Sources/SqlDatabase.Sequence/ScriptDependency.cs @@ -1,8 +1,8 @@ using System; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; -public readonly struct ScriptDependency : IEquatable +internal readonly struct ScriptDependency : IEquatable { public ScriptDependency(string moduleName, Version version) { @@ -20,7 +20,7 @@ public bool Equals(ScriptDependency other) && Version == other.Version; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { return obj is ScriptDependency d && Equals(d); } @@ -33,5 +33,5 @@ public override int GetHashCode() return (int)((uint)(h1 << 5) | (uint)h1 >> 27) + h1 ^ h2; } - public override string ToString() => "{0} {1}".FormatWith(ModuleName, Version); + public override string ToString() => $"{ModuleName} {Version}"; } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/ScriptStep.cs b/Sources/SqlDatabase.Sequence/ScriptStep.cs similarity index 88% rename from Sources/SqlDatabase/Scripts/ScriptStep.cs rename to Sources/SqlDatabase.Sequence/ScriptStep.cs index 4c816aef..b008b11d 100644 --- a/Sources/SqlDatabase/Scripts/ScriptStep.cs +++ b/Sources/SqlDatabase.Sequence/ScriptStep.cs @@ -1,7 +1,8 @@ using System; using System.Diagnostics; +using SqlDatabase.Adapter; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; [DebuggerDisplay("{Script.DisplayName}")] public readonly struct ScriptStep diff --git a/Sources/SqlDatabase.Sequence/SqlDatabase.Sequence.csproj b/Sources/SqlDatabase.Sequence/SqlDatabase.Sequence.csproj new file mode 100644 index 00000000..dfc4d620 --- /dev/null +++ b/Sources/SqlDatabase.Sequence/SqlDatabase.Sequence.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/Sources/SqlDatabase/Scripts/UpgradeInternal/UpgradeScriptCollection.cs b/Sources/SqlDatabase.Sequence/UpgradeScriptCollection.cs similarity index 71% rename from Sources/SqlDatabase/Scripts/UpgradeInternal/UpgradeScriptCollection.cs rename to Sources/SqlDatabase.Sequence/UpgradeScriptCollection.cs index 649bc621..83cf967e 100644 --- a/Sources/SqlDatabase/Scripts/UpgradeInternal/UpgradeScriptCollection.cs +++ b/Sources/SqlDatabase.Sequence/UpgradeScriptCollection.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; -using SqlDatabase.IO; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; -namespace SqlDatabase.Scripts.UpgradeInternal; +namespace SqlDatabase.Sequence; internal sealed class UpgradeScriptCollection { @@ -43,10 +45,10 @@ public void BuildModuleSequence(string moduleName, Version moduleVersion) { if (string.IsNullOrEmpty(moduleName)) { - throw new InvalidOperationException("The current version [{0}] is greater then latest upgrade [{1}].".FormatWith(moduleVersion, maxVersion)); + throw new InvalidOperationException($"The current version [{moduleVersion}] is greater then latest upgrade [{maxVersion}]."); } - throw new InvalidOperationException("Module [{0}], the current version [{1}] is greater then latest upgrade [{2}].".FormatWith(moduleName, moduleVersion, maxVersion)); + throw new InvalidOperationException($"Module [{moduleName}], the current version [{moduleVersion}] is greater then latest upgrade [{maxVersion}]."); } files = files @@ -71,10 +73,10 @@ public void BuildModuleSequence(string moduleName, Version moduleVersion) { if (string.IsNullOrEmpty(moduleName)) { - throw new InvalidOperationException("Duplicated step found [{0}] and [{1}].".FormatWith(file.Script.DisplayName, files[0].Script.DisplayName)); + throw new InvalidOperationException($"Duplicated step found [{file.Script.DisplayName}] and [{files[0].Script.DisplayName}]."); } - throw new InvalidOperationException("Module [{0}], duplicated step found [{1}] and [{2}].".FormatWith(moduleName, file.Script.DisplayName, files[0].Script.DisplayName)); + throw new InvalidOperationException($"Module [{moduleName}], duplicated step found [{file.Script.DisplayName}] and [{files[0].Script.DisplayName}]."); } sequence.Add(file); @@ -85,10 +87,10 @@ public void BuildModuleSequence(string moduleName, Version moduleVersion) { if (string.IsNullOrEmpty(moduleName)) { - throw new InvalidOperationException("Upgrade step from [{0}] to a next not found.".FormatWith(version)); + throw new InvalidOperationException($"Upgrade step from [{version}] to a next not found."); } - throw new InvalidOperationException("Module [{0}], upgrade step from [{1}] to a next not found.".FormatWith(moduleName, version)); + throw new InvalidOperationException($"Module [{moduleName}], upgrade step from [{version}] to a next not found."); } _stepsByModule[moduleName] = sequence; @@ -100,7 +102,13 @@ public void LoadDependencies() { foreach (var step in steps) { - var dependencies = step.Script.GetDependencies(); + var dependencies = Array.Empty(); + using var reader = step.Script.GetDependencies(); + if (reader != null) + { + dependencies = DependencyParser.ExtractDependencies(reader, step.Script.DisplayName).ToArray(); + } + _dependencyByStep.Add(step.Script, dependencies); } } @@ -111,10 +119,9 @@ public void ShowWithDependencies(ILogger logger) foreach (var moduleName in _stepsByModule.Keys.OrderBy(i => i)) { var steps = _stepsByModule[moduleName]; - logger.Info("module [{0}], {1} step{2}:".FormatWith( - moduleName, - steps.Count, - steps.Count == 1 ? null : "s")); + + var s = steps.Count == 1 ? null : "s"; + logger.Info($"module [{moduleName}], {steps.Count} step{s}:"); using (logger.Indent()) { @@ -123,13 +130,12 @@ public void ShowWithDependencies(ILogger logger) var dependencies = GetDependencies(step); if (dependencies.Count == 0) { - logger.Info("{0}, no dependencies".FormatWith(step.Script.DisplayName)); + logger.Info($"{step.Script.DisplayName}, no dependencies"); } else { - logger.Info("{0}, depends on {1}".FormatWith( - step.Script.DisplayName, - string.Join("; ", dependencies.OrderBy(i => i.ModuleName)))); + var dependsOn = string.Join("; ", dependencies.OrderBy(i => i.ModuleName)); + logger.Info($"{step.Script.DisplayName}, depends on {dependsOn}"); } } } @@ -145,11 +151,7 @@ public void ValidateModuleDependencies(string moduleName, IModuleVersionResolver var currentVersion = versionResolver.GetCurrentVersion(dependency.ModuleName); if (currentVersion > dependency.Version) { - throw new InvalidOperationException("Migration step [{0}] requires module [{1}] to be version [{2}], but current is [{3}].".FormatWith( - step.Script.DisplayName, - dependency.ModuleName, - dependency.Version, - currentVersion)); + throw new InvalidOperationException($"Migration step [{step.Script.DisplayName}] requires module [{dependency.ModuleName}] to be version [{dependency.Version}], but current is [{currentVersion}]."); } if (currentVersion != dependency.Version) @@ -159,10 +161,7 @@ public void ValidateModuleDependencies(string moduleName, IModuleVersionResolver if (!contains) { - throw new InvalidOperationException("Migration step [{0}] depends on module [{1}] version [{2}], but upgrade for this module not found.".FormatWith( - step.Script.DisplayName, - dependency.ModuleName, - dependency.Version)); + throw new InvalidOperationException($"Migration step [{step.Script.DisplayName}] depends on module [{dependency.ModuleName}] version [{dependency.Version}], but upgrade for this module not found."); } } } @@ -208,7 +207,11 @@ public bool TestStep(IDictionary versionByModule, string stepMo return !objections; } - internal static bool TryParseFileName(string name, out string moduleName, out Version from, out Version to) + internal static bool TryParseFileName( + string name, + [NotNullWhen(true)] out string? moduleName, + [NotNullWhen(true)] out Version? from, + [NotNullWhen(true)] out Version? to) { moduleName = null; from = null; @@ -250,7 +253,7 @@ internal static bool TryParseFileName(string name, out string moduleName, out Ve return from != null && to != null && from < to; } - private static Version ParseVersion(string value) + private static Version? ParseVersion(string value) { if (Version.TryParse(value, out var ver)) { @@ -265,7 +268,7 @@ private static Version ParseVersion(string value) return null; } - private void LoadFrom(IEnumerable sources, IScriptFactory scriptFactory, int depth, string rootFolderName) + private void LoadFrom(IEnumerable sources, IScriptFactory scriptFactory, int depth, string? rootFolderName) { foreach (var source in sources) { @@ -282,16 +285,16 @@ private void LoadFrom(IEnumerable sources, IScriptFactory scrip else { var file = (IFile)source; - if (scriptFactory.IsSupported(file.Name) && TryParseFileName(file.Name, out var moduleName, out var from, out var to)) + if (scriptFactory.IsSupported(file) && TryParseFileName(file.Name, out var moduleName, out var from, out var to)) { if (FolderAsModuleName && string.IsNullOrEmpty(rootFolderName)) { - throw new InvalidOperationException("File [{0}] is not expected in the root folder.".FormatWith(file.Name)); + throw new InvalidOperationException($"File [{file.Name}] is not expected in the root folder."); } if (FolderAsModuleName && !string.IsNullOrEmpty(moduleName) && !moduleName.Equals(rootFolderName, StringComparison.OrdinalIgnoreCase)) { - throw new InvalidOperationException("File [{0}] with module name [{1}] is not expected in the folder [{2}].".FormatWith(file.Name, moduleName, rootFolderName)); + throw new InvalidOperationException($"File [{file.Name}] with module name [{moduleName}] is not expected in the folder [{rootFolderName}]."); } if (FolderAsModuleName) @@ -299,14 +302,14 @@ private void LoadFrom(IEnumerable sources, IScriptFactory scrip moduleName = rootFolderName; } - if (!_stepsByModule.TryGetValue(moduleName, out var steps)) + if (!_stepsByModule.TryGetValue(moduleName!, out var steps)) { steps = new List(); - _stepsByModule.Add(moduleName, steps); + _stepsByModule.Add(moduleName!, steps); } var script = scriptFactory.FromFile(file); - steps.Add(new ScriptStep(moduleName, from, to, script)); + steps.Add(new ScriptStep(moduleName!, from, to, script)); } } } diff --git a/Sources/SqlDatabase/Scripts/UpgradeScriptSequence.cs b/Sources/SqlDatabase.Sequence/UpgradeScriptSequence.cs similarity index 73% rename from Sources/SqlDatabase/Scripts/UpgradeScriptSequence.cs rename to Sources/SqlDatabase.Sequence/UpgradeScriptSequence.cs index 4aebc59f..3c838782 100644 --- a/Sources/SqlDatabase/Scripts/UpgradeScriptSequence.cs +++ b/Sources/SqlDatabase.Sequence/UpgradeScriptSequence.cs @@ -2,24 +2,51 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using SqlDatabase.IO; -using SqlDatabase.Scripts.UpgradeInternal; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; -namespace SqlDatabase.Scripts; +namespace SqlDatabase.Sequence; -internal sealed class UpgradeScriptSequence : IUpgradeScriptSequence +public sealed class UpgradeScriptSequence : IUpgradeScriptSequence { - public IList Sources { get; set; } = new List(); + public UpgradeScriptSequence( + IScriptFactory scriptFactory, + GetDatabaseCurrentVersion versionResolver, + IList sources, + ILogger log, + bool folderAsModuleName, + bool whatIf) + : this(scriptFactory, new ModuleVersionResolver(log, versionResolver), sources, log, folderAsModuleName, whatIf) + { + } + + internal UpgradeScriptSequence( + IScriptFactory scriptFactory, + IModuleVersionResolver versionResolver, + IList sources, + ILogger log, + bool folderAsModuleName, + bool whatIf) + { + ScriptFactory = scriptFactory; + VersionResolver = versionResolver; + Sources = sources; + Log = log; + FolderAsModuleName = folderAsModuleName; + WhatIf = whatIf; + } - public IScriptFactory ScriptFactory { get; set; } + public IList Sources { get; } - public IModuleVersionResolver VersionResolver { get; set; } + public IScriptFactory ScriptFactory { get; } - public ILogger Log { get; set; } + public ILogger Log { get; } public bool FolderAsModuleName { get; set; } - public bool WhatIf { get; set; } + public bool WhatIf { get; } + + internal IModuleVersionResolver VersionResolver { get; } public IList BuildSequence() { @@ -29,7 +56,7 @@ public IList BuildSequence() // folder is empty if (scripts.ModuleNames.Count == 0) { - return new ScriptStep[0]; + return Array.Empty(); } foreach (var moduleName in scripts.ModuleNames.ToArray()) @@ -40,7 +67,7 @@ public IList BuildSequence() // no updates if (scripts.ModuleNames.Count == 0) { - return new ScriptStep[0]; + return Array.Empty(); } // no modules @@ -83,7 +110,7 @@ private IList BuildSequence(UpgradeScriptCollection scripts) while (scripts.ModuleNames.Count > 0) { var nextStep = default(ScriptStep); - string nextStepModuleName = null; + string? nextStepModuleName = null; foreach (var moduleName in scripts.ModuleNames) { diff --git a/Sources/SqlDatabase.Test/Commands/DatabaseCreateCommandTest.cs b/Sources/SqlDatabase.Test/Commands/DatabaseCreateCommandTest.cs index de378fc0..33bff8ac 100644 --- a/Sources/SqlDatabase.Test/Commands/DatabaseCreateCommandTest.cs +++ b/Sources/SqlDatabase.Test/Commands/DatabaseCreateCommandTest.cs @@ -1,19 +1,22 @@ using System; -using System.Configuration; using Moq; using NUnit.Framework; +using SqlDatabase.Adapter; +using SqlDatabase.Configuration; using SqlDatabase.Scripts; +using SqlDatabase.Sequence; +using SqlDatabase.TestApi; namespace SqlDatabase.Commands; [TestFixture] public class DatabaseCreateCommandTest { - private DatabaseCreateCommand _sut; - private Mock _database; - private Mock _scriptSequence; - private Mock _powerShellFactory; - private Mock _log; + private DatabaseCreateCommand _sut = null!; + private Mock _database = null!; + private Mock _scriptSequence = null!; + private Mock _scriptResolver = null!; + private Mock _log = null!; [SetUp] public void BeforeEachTest() @@ -29,36 +32,34 @@ public void BeforeEachTest() _scriptSequence = new Mock(MockBehavior.Strict); - _powerShellFactory = new Mock(MockBehavior.Strict); + _scriptResolver = new Mock(MockBehavior.Strict); _log = new Mock(MockBehavior.Strict); - _log.Setup(l => l.Indent()).Returns((IDisposable)null); + _log.Setup(l => l.Indent()).Returns((IDisposable)null!); _log .Setup(l => l.Error(It.IsAny())) .Callback(m => { - Console.WriteLine("Error: {0}", m); + TestOutput.WriteLine("Error: {0}", m); }); _log .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); }); - _sut = new DatabaseCreateCommand - { - Database = _database.Object, - Log = _log.Object, - ScriptSequence = _scriptSequence.Object, - PowerShellFactory = _powerShellFactory.Object - }; + _sut = new DatabaseCreateCommand( + _scriptSequence.Object, + _scriptResolver.Object, + _database.Object, + _log.Object); } [Test] public void ScriptsNotFound() { - _scriptSequence.Setup(s => s.BuildSequence()).Returns(new IScript[0]); + _scriptSequence.Setup(s => s.BuildSequence()).Returns(Array.Empty()); Assert.Throws(_sut.Execute); @@ -74,20 +75,24 @@ public void ExecuteSequence() var step2 = new Mock(MockBehavior.Strict); step2.SetupGet(s => s.DisplayName).Returns("step 2"); - _powerShellFactory - .Setup(f => f.InitializeIfRequested(_log.Object)); + var sequence = new[] { step1.Object, step2.Object }; + + _scriptResolver + .Setup(f => f.InitializeEnvironment(_log.Object, sequence)); _database .Setup(d => d.Execute(step1.Object)) .Callback(() => _database.Setup(d => d.Execute(step2.Object))); - _scriptSequence.Setup(s => s.BuildSequence()).Returns(new[] { step1.Object, step2.Object }); + _scriptSequence + .Setup(s => s.BuildSequence()) + .Returns(sequence); _sut.Execute(); _database.VerifyAll(); _scriptSequence.VerifyAll(); - _powerShellFactory.VerifyAll(); + _scriptResolver.VerifyAll(); } [Test] @@ -99,19 +104,23 @@ public void StopExecutionOnError() var step2 = new Mock(MockBehavior.Strict); step2.SetupGet(s => s.DisplayName).Returns("step 2"); - _powerShellFactory - .Setup(f => f.InitializeIfRequested(_log.Object)); + var sequence = new[] { step1.Object, step2.Object }; + + _scriptResolver + .Setup(f => f.InitializeEnvironment(_log.Object, sequence)); _database .Setup(d => d.Execute(step1.Object)) .Throws(); - _scriptSequence.Setup(s => s.BuildSequence()).Returns(new[] { step1.Object, step2.Object }); + _scriptSequence + .Setup(s => s.BuildSequence()) + .Returns(sequence); Assert.Throws(_sut.Execute); _database.VerifyAll(); _scriptSequence.VerifyAll(); - _powerShellFactory.VerifyAll(); + _scriptResolver.VerifyAll(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Commands/DatabaseExecuteCommandTest.cs b/Sources/SqlDatabase.Test/Commands/DatabaseExecuteCommandTest.cs index ba302585..f337b178 100644 --- a/Sources/SqlDatabase.Test/Commands/DatabaseExecuteCommandTest.cs +++ b/Sources/SqlDatabase.Test/Commands/DatabaseExecuteCommandTest.cs @@ -1,18 +1,21 @@ using System; using Moq; using NUnit.Framework; +using SqlDatabase.Adapter; using SqlDatabase.Scripts; +using SqlDatabase.Sequence; +using SqlDatabase.TestApi; namespace SqlDatabase.Commands; [TestFixture] public class DatabaseExecuteCommandTest { - private DatabaseExecuteCommand _sut; - private Mock _database; - private Mock _scriptSequence; - private Mock _powerShellFactory; - private Mock _log; + private DatabaseExecuteCommand _sut = null!; + private Mock _database = null!; + private Mock _scriptSequence = null!; + private Mock _scriptResolver = null!; + private Mock _log = null!; [SetUp] public void BeforeEachTest() @@ -28,24 +31,22 @@ public void BeforeEachTest() _scriptSequence = new Mock(MockBehavior.Strict); - _powerShellFactory = new Mock(MockBehavior.Strict); + _scriptResolver = new Mock(MockBehavior.Strict); _log = new Mock(MockBehavior.Strict); - _log.Setup(l => l.Indent()).Returns((IDisposable)null); + _log.Setup(l => l.Indent()).Returns((IDisposable)null!); _log .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); }); - _sut = new DatabaseExecuteCommand - { - Database = _database.Object, - Log = _log.Object, - ScriptSequence = _scriptSequence.Object, - PowerShellFactory = _powerShellFactory.Object - }; + _sut = new DatabaseExecuteCommand( + _scriptSequence.Object, + _scriptResolver.Object, + _database.Object, + _log.Object); } [Test] @@ -57,20 +58,22 @@ public void ExecuteOneScript() var script2 = new Mock(MockBehavior.Strict); script2.SetupGet(s => s.DisplayName).Returns("step 2"); - _powerShellFactory - .Setup(f => f.InitializeIfRequested(_log.Object)); + var sequence = new[] { script1.Object, script2.Object }; + + _scriptResolver + .Setup(f => f.InitializeEnvironment(_log.Object, sequence)); _database .Setup(d => d.Execute(script1.Object)) .Callback(() => _database.Setup(d => d.Execute(script2.Object))); - _scriptSequence.Setup(s => s.BuildSequence()).Returns(new[] { script1.Object, script2.Object }); + _scriptSequence.Setup(s => s.BuildSequence()).Returns(sequence); _sut.Execute(); _database.VerifyAll(); script1.VerifyAll(); script2.VerifyAll(); - _powerShellFactory.VerifyAll(); + _scriptResolver.VerifyAll(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Commands/DatabaseExportCommandTest.cs b/Sources/SqlDatabase.Test/Commands/DatabaseExportCommandTest.cs index 150e3039..d0885ccc 100644 --- a/Sources/SqlDatabase.Test/Commands/DatabaseExportCommandTest.cs +++ b/Sources/SqlDatabase.Test/Commands/DatabaseExportCommandTest.cs @@ -3,19 +3,23 @@ using System.IO; using Moq; using NUnit.Framework; -using SqlDatabase.Export; +using SqlDatabase.Adapter; +using SqlDatabase.Adapter.Sql.Export; using SqlDatabase.Scripts; -using SqlDatabase.Scripts.MsSql; +using SqlDatabase.Sequence; +using SqlDatabase.TestApi; namespace SqlDatabase.Commands; [TestFixture] public class DatabaseExportCommandTest { - private DatabaseExportCommand _sut; - private Mock _database; - private Mock _scriptSequence; - private Mock _exporter; + private DatabaseExportCommand _sut = null!; + private Mock _database = null!; + private Mock _scriptSequence = null!; + private Mock _scriptResolver = null!; + private Mock _logger = null!; + private Mock _exporter = null!; [SetUp] public void BeforeEachTest() @@ -26,7 +30,7 @@ public void BeforeEachTest() .Returns("host; database"); adapter .Setup(a => a.CreateSqlWriter(It.IsAny())) - .Returns(output => new MsSqlWriter(output)); + .Returns(output => new Mock(MockBehavior.Loose, output) { CallBase = true }.Object); _database = new Mock(MockBehavior.Strict); _database.SetupGet(d => d.Adapter).Returns(adapter.Object); @@ -34,28 +38,31 @@ public void BeforeEachTest() _scriptSequence = new Mock(MockBehavior.Strict); - var log = new Mock(MockBehavior.Strict); - log.Setup(l => l.Indent()).Returns((IDisposable)null); - log + _scriptResolver = new Mock(MockBehavior.Strict); + + _logger = new Mock(MockBehavior.Strict); + _logger.Setup(l => l.Indent()).Returns((IDisposable)null!); + _logger .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); }); _exporter = new Mock(MockBehavior.Strict); _exporter .SetupProperty(e => e.Output); _exporter - .SetupSet(e => e.Log = log.Object); - - _sut = new DatabaseExportCommand + .SetupSet(e => e.Log = _logger.Object); + + _sut = new DatabaseExportCommand( + _scriptSequence.Object, + _scriptResolver.Object, + () => Console.Out, + _database.Object, + _logger.Object) { - Database = _database.Object, - Log = log.Object, - ScriptSequence = _scriptSequence.Object, ExporterFactory = () => _exporter.Object, - OpenOutput = () => Console.Out }; } @@ -65,6 +72,11 @@ public void ExportOneScript() var script = new Mock(MockBehavior.Strict); script.SetupGet(s => s.DisplayName).Returns("display name"); + var sequence = new[] { script.Object }; + + _scriptResolver + .Setup(f => f.InitializeEnvironment(_logger.Object, sequence)); + var reader = new Mock(MockBehavior.Strict); reader .Setup(r => r.NextResult()) @@ -77,13 +89,16 @@ public void ExportOneScript() _exporter .Setup(e => e.Export(reader.Object, "dbo.SqlDatabaseExport")); - _scriptSequence.Setup(s => s.BuildSequence()).Returns(new[] { script.Object }); + _scriptSequence + .Setup(s => s.BuildSequence()) + .Returns(sequence); _sut.Execute(); _database.VerifyAll(); script.VerifyAll(); _exporter.VerifyAll(); + _scriptResolver.VerifyAll(); } [Test] @@ -92,6 +107,11 @@ public void ReaderNextResult() var script = new Mock(MockBehavior.Strict); script.SetupGet(s => s.DisplayName).Returns("display name"); + var sequence = new[] { script.Object }; + + _scriptResolver + .Setup(f => f.InitializeEnvironment(_logger.Object, sequence)); + var reader = new Mock(MockBehavior.Strict); reader .Setup(r => r.NextResult()) @@ -108,12 +128,15 @@ public void ReaderNextResult() _exporter .Setup(e => e.Export(reader.Object, "dbo.SqlDatabaseExport_2")); - _scriptSequence.Setup(s => s.BuildSequence()).Returns(new[] { script.Object }); + _scriptSequence + .Setup(s => s.BuildSequence()) + .Returns(sequence); _sut.Execute(); _database.VerifyAll(); script.VerifyAll(); _exporter.VerifyAll(); + _scriptResolver.VerifyAll(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Commands/DatabaseUpgradeCommandTest.cs b/Sources/SqlDatabase.Test/Commands/DatabaseUpgradeCommandTest.cs index b391967b..c93c5380 100644 --- a/Sources/SqlDatabase.Test/Commands/DatabaseUpgradeCommandTest.cs +++ b/Sources/SqlDatabase.Test/Commands/DatabaseUpgradeCommandTest.cs @@ -1,18 +1,21 @@ using System; using Moq; using NUnit.Framework; +using SqlDatabase.Adapter; using SqlDatabase.Scripts; +using SqlDatabase.Sequence; +using SqlDatabase.TestApi; namespace SqlDatabase.Commands; [TestFixture] public class DatabaseUpgradeCommandTest { - private DatabaseUpgradeCommand _sut; - private Mock _database; - private Mock _scriptSequence; - private Mock _powerShellFactory; - private Mock _log; + private DatabaseUpgradeCommand _sut = null!; + private Mock _database = null!; + private Mock _scriptSequence = null!; + private Mock _scriptResolver = null!; + private Mock _log = null!; [SetUp] public void BeforeEachTest() @@ -28,36 +31,34 @@ public void BeforeEachTest() _scriptSequence = new Mock(MockBehavior.Strict); - _powerShellFactory = new Mock(MockBehavior.Strict); + _scriptResolver = new Mock(MockBehavior.Strict); _log = new Mock(MockBehavior.Strict); - _log.Setup(l => l.Indent()).Returns((IDisposable)null); + _log.Setup(l => l.Indent()).Returns((IDisposable)null!); _log .Setup(l => l.Error(It.IsAny())) .Callback(m => { - Console.WriteLine("Error: {0}", m); + TestOutput.WriteLine("Error: {0}", m); }); _log .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); }); - _sut = new DatabaseUpgradeCommand - { - Database = _database.Object, - Log = _log.Object, - ScriptSequence = _scriptSequence.Object, - PowerShellFactory = _powerShellFactory.Object - }; + _sut = new DatabaseUpgradeCommand( + _scriptSequence.Object, + _scriptResolver.Object, + _database.Object, + _log.Object); } [Test] public void DatabaseIsUpToDate() { - _scriptSequence.Setup(s => s.BuildSequence()).Returns(new ScriptStep[0]); + _scriptSequence.Setup(s => s.BuildSequence()).Returns(Array.Empty()); _sut.Execute(); @@ -79,8 +80,8 @@ public void ExecuteSequence() var stepTo2 = new ScriptStep("module1", currentVersion, new Version("2.0"), updateTo2.Object); var stepTo3 = new ScriptStep("module2", new Version("2.0"), new Version("3.0"), updateTo3.Object); - _powerShellFactory - .Setup(f => f.InitializeIfRequested(_log.Object)); + _scriptResolver + .Setup(f => f.InitializeEnvironment(_log.Object, new[] { stepTo2.Script, stepTo3.Script })); _database .Setup(d => d.Execute(updateTo2.Object, "module1", stepTo2.From, stepTo2.To)) @@ -92,7 +93,7 @@ public void ExecuteSequence() _database.VerifyAll(); _scriptSequence.VerifyAll(); - _powerShellFactory.VerifyAll(); + _scriptResolver.VerifyAll(); } [Test] @@ -109,8 +110,8 @@ public void StopExecutionOnError() var stepTo2 = new ScriptStep(string.Empty, currentVersion, new Version("2.0"), updateTo2.Object); var stepTo3 = new ScriptStep(string.Empty, new Version("2.0"), new Version("3.0"), updateTo3.Object); - _powerShellFactory - .Setup(f => f.InitializeIfRequested(_log.Object)); + _scriptResolver + .Setup(f => f.InitializeEnvironment(_log.Object, new[] { stepTo2.Script, stepTo3.Script })); _database.Setup(d => d.Execute(updateTo2.Object, string.Empty, stepTo2.From, stepTo2.To)).Throws(); @@ -120,6 +121,6 @@ public void StopExecutionOnError() _database.VerifyAll(); _scriptSequence.VerifyAll(); - _powerShellFactory.VerifyAll(); + _scriptResolver.VerifyAll(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Configuration/AppConfiguration.default.xml b/Sources/SqlDatabase.Test/Configuration/AppConfiguration.default.xml deleted file mode 100644 index 879ae67c..00000000 --- a/Sources/SqlDatabase.Test/Configuration/AppConfiguration.default.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - -
- - - - diff --git a/Sources/SqlDatabase.Test/Configuration/CommandLineBaseTest.cs b/Sources/SqlDatabase.Test/Configuration/CommandLineBaseTest.cs index d2690f9b..a2635078 100644 --- a/Sources/SqlDatabase.Test/Configuration/CommandLineBaseTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/CommandLineBaseTest.cs @@ -1,81 +1,26 @@ -using System; -using System.Configuration; -using Moq; +using Moq; using NUnit.Framework; using Shouldly; -using SqlDatabase.IO; -using SqlDatabase.TestApi; +using SqlDatabase.FileSystem; namespace SqlDatabase.Configuration; [TestFixture] public class CommandLineBaseTest { - private Mock _log; - private Mock _configurationManager; - private AppConfiguration _configuration; - private Mock _fs; - private CommandLineBase _sut; + private Mock _fs = null!; + private CommandLineBase _sut = null!; [SetUp] public void BeforeEachTest() { - _log = new Mock(MockBehavior.Strict); - - _configuration = new AppConfiguration(); - - _configurationManager = new Mock(MockBehavior.Strict); - _configurationManager - .SetupGet(c => c.SqlDatabase) - .Returns(_configuration); - _fs = new Mock(MockBehavior.Strict); _sut = new Mock { CallBase = true }.Object; - _sut.ConnectionString = MsSqlQuery.ConnectionString; + _sut.ConnectionString = "connection-string"; _sut.FileSystemFactory = _fs.Object; } - [Test] - public void CreateDatabase() - { - var actual = _sut.CreateDatabase(_log.Object, _configurationManager.Object, TransactionMode.PerStep, true); - - actual.Log.ShouldBe(_log.Object); - actual.Adapter.ShouldNotBeNull(); - actual.Transaction.ShouldBe(TransactionMode.PerStep); - actual.WhatIf.ShouldBeTrue(); - } - - [Test] - public void CreateDatabaseApplyVariables() - { - _sut.Variables.Add("a", "1"); - _sut.Variables.Add("b", "2"); - - _configuration.Variables.Add(new NameValueConfigurationElement("b", "2.2")); - _configuration.Variables.Add(new NameValueConfigurationElement("c", "3")); - - var actual = _sut.CreateDatabase(_log.Object, _configurationManager.Object, TransactionMode.None, false); - - Assert.AreEqual("1", actual.Variables.GetValue("a")); - Assert.AreEqual("2", actual.Variables.GetValue("b")); - Assert.AreEqual("3", actual.Variables.GetValue("c")); - } - - [Test] - public void CreateDatabaseValidateVariables() - { - _sut.Variables.Add("a b", "1"); - - _configuration.Variables.Add(new NameValueConfigurationElement("c d", "1")); - - var ex = Assert.Throws(() => _sut.CreateDatabase(_log.Object, _configurationManager.Object, TransactionMode.None, false)); - - ex.Message.ShouldContain("a b"); - ex.Message.ShouldContain("c d"); - } - [Test] public void ParseFrom() { diff --git a/Sources/SqlDatabase.Test/Configuration/CommandLineFactoryTest.cs b/Sources/SqlDatabase.Test/Configuration/CommandLineFactoryTest.cs index d153ca9e..27b3e0f9 100644 --- a/Sources/SqlDatabase.Test/Configuration/CommandLineFactoryTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/CommandLineFactoryTest.cs @@ -7,7 +7,7 @@ namespace SqlDatabase.Configuration; [TestFixture] public class CommandLineFactoryTest { - private CommandLineFactory _sut; + private CommandLineFactory _sut = null!; [SetUp] public void BeforeEachTest() @@ -36,7 +36,7 @@ public void Bind(string command, Type commandLine) [Test] public void BindEmptyCommandLine() { - _sut.Args = new CommandLine(new Arg[0], new string[0]); + _sut.Args = new CommandLine(Array.Empty(), Array.Empty()); _sut.Bind().ShouldBeFalse(); } @@ -48,7 +48,7 @@ public void BindUnknownCommand() var ex = Assert.Throws(() => _sut.Bind()); - ex.Message.ShouldContain("[Unknown]"); + ex?.Message.ShouldContain("[Unknown]"); } [Test] diff --git a/Sources/SqlDatabase.Test/Configuration/CommandLineParserTest.cs b/Sources/SqlDatabase.Test/Configuration/CommandLineParserTest.cs index a31c9db8..66a7baa6 100644 --- a/Sources/SqlDatabase.Test/Configuration/CommandLineParserTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/CommandLineParserTest.cs @@ -6,7 +6,7 @@ namespace SqlDatabase.Configuration; [TestFixture] public class CommandLineParserTest { - private CommandLineParser _sut; + private CommandLineParser _sut = null!; [SetUp] public void BeforeEachTest() @@ -22,7 +22,7 @@ public void BeforeEachTest() [TestCase("-=x", null, null, false)] [TestCase("-=", null, null, false)] [TestCase("-", null, null, false)] - public void SplitArg(string keyValue, string expectedKey, string expectedValue, bool isValid) + public void SplitArg(string keyValue, string? expectedKey, string? expectedValue, bool isValid) { CommandLineParser.ParseArg(keyValue, out var actual).ShouldBe(isValid); if (isValid) diff --git a/Sources/SqlDatabase.Test/Configuration/ConfigurationManagerTest.cs b/Sources/SqlDatabase.Test/Configuration/ConfigurationManagerTest.cs deleted file mode 100644 index 0380c5d2..00000000 --- a/Sources/SqlDatabase.Test/Configuration/ConfigurationManagerTest.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Configuration; -using System.IO; -using NUnit.Framework; -using Shouldly; -using SqlDatabase.TestApi; - -namespace SqlDatabase.Configuration; - -[TestFixture] -public class ConfigurationManagerTest -{ - public const string SomeConfiguration = @" - - -
- - - - - -"; - - private ConfigurationManager _sut; - - [SetUp] - public void BeforeEachTest() - { - _sut = new ConfigurationManager(); - } - - [Test] - public void LoadFromCurrentConfiguration() - { - _sut.LoadFrom((string)null); - - _sut.SqlDatabase.ShouldNotBeNull(); - _sut.SqlDatabase.Variables.AllKeys.ShouldBe(new[] { nameof(ConfigurationManagerTest) }); - _sut.SqlDatabase.Variables[nameof(ConfigurationManagerTest)].Value.ShouldBe(nameof(LoadFromCurrentConfiguration)); - } - - [Test] - public void LoadFromEmptyFile() - { - var file = FileFactory.File("app.config", ""); - - _sut.LoadFrom(file); - - Assert.IsNotNull(_sut.SqlDatabase); - Assert.AreEqual(new AppConfiguration().GetCurrentVersionScript, _sut.SqlDatabase.GetCurrentVersionScript); - } - - [Test] - public void LoadFromFile() - { - var file = FileFactory.File("app.config", SomeConfiguration); - - _sut.LoadFrom(file); - - Assert.IsNotNull(_sut.SqlDatabase); - Assert.AreEqual("expected", _sut.SqlDatabase.GetCurrentVersionScript); - } - - [Test] - public void LoadFromDirectory() - { - // SqlDatabase.exe.config or SqlDatabase.dll.config - var fileName = Path.GetFileName(_sut.GetType().Assembly.Location) + ".config"; - var file = FileFactory.File(fileName, SomeConfiguration); - var folder = FileFactory.Folder("some folder", file); - - _sut.LoadFrom(folder); - - Assert.IsNotNull(_sut.SqlDatabase); - Assert.AreEqual("expected", _sut.SqlDatabase.GetCurrentVersionScript); - } - - [Test] - public void NotFoundInDirectory() - { - var folder = FileFactory.Folder("some folder"); - - Assert.Throws(() => _sut.LoadFrom(folder)); - } - - [Test] - public void FileNotFound() - { - var file = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); - - Assert.Throws(() => _sut.LoadFrom(file)); - } - - [Test] - public void LoadInvalidConfiguration() - { - var file = FileFactory.File("app.config", ""); - - Assert.Throws(() => _sut.LoadFrom(file)); - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Configuration/CreateCommandLineTest.cs b/Sources/SqlDatabase.Test/Configuration/CreateCommandLineTest.cs index c8d770c3..bbd31da4 100644 --- a/Sources/SqlDatabase.Test/Configuration/CreateCommandLineTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/CreateCommandLineTest.cs @@ -1,19 +1,18 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; using SqlDatabase.Commands; -using SqlDatabase.IO; -using SqlDatabase.Scripts; -using SqlDatabase.TestApi; +using SqlDatabase.FileSystem; namespace SqlDatabase.Configuration; [TestFixture] public class CreateCommandLineTest { - private Mock _log; - private Mock _fs; - private CreateCommandLine _sut; + private Mock _log = null!; + private Mock _fs = null!; + private CreateCommandLine _sut = null!; [SetUp] public void BeforeEachTest() @@ -64,20 +63,27 @@ public void Parse() public void CreateCommand() { _sut.WhatIf = true; - _sut.ConnectionString = MsSqlQuery.ConnectionString; + _sut.ConnectionString = "connection string"; _sut.UsePowerShell = @"c:\PowerShell"; + var builder = new EnvironmentBuilderMock() + .WithLogger(_log.Object) + .WithConfiguration(_sut.ConfigurationFile) + .WithPowerShellScripts(_sut.UsePowerShell) + .WithAssemblyScripts() + .WithVariables(_sut.Variables) + .WithDataBase(_sut.ConnectionString, TransactionMode.None, _sut.WhatIf) + .WithCreateSequence(_sut.Scripts); + var actual = _sut - .CreateCommand(_log.Object) + .CreateCommand(_log.Object, builder.Build()) .ShouldBeOfType(); - actual.Log.ShouldBe(_log.Object); - var database = actual.Database.ShouldBeOfType(); - database.WhatIf.ShouldBeTrue(); - - var scriptFactory = actual.ScriptSequence.ShouldBeOfType().ScriptFactory.ShouldBeOfType(); - scriptFactory.PowerShellFactory.InstallationPath.ShouldBe(@"c:\PowerShell"); + builder.VerifyAll(); - actual.PowerShellFactory.ShouldBe(scriptFactory.PowerShellFactory); + actual.Log.ShouldBe(_log.Object); + actual.Database.ShouldBe(builder.Database); + actual.ScriptResolver.ShouldBe(builder.ScriptResolver); + actual.ScriptSequence.ShouldBe(builder.CreateSequence); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Configuration/EnvironmentBuilderMock.cs b/Sources/SqlDatabase.Test/Configuration/EnvironmentBuilderMock.cs new file mode 100644 index 00000000..1d911f81 --- /dev/null +++ b/Sources/SqlDatabase.Test/Configuration/EnvironmentBuilderMock.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using System.Linq; +using Moq; +using Shouldly; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; +using SqlDatabase.Scripts; +using SqlDatabase.Sequence; + +namespace SqlDatabase.Configuration; + +internal sealed class EnvironmentBuilderMock +{ + private readonly Mock _mock = new(MockBehavior.Strict); + private readonly List _mockSequence = new(); + + public IDatabase Database { get; } = new Mock(MockBehavior.Strict).Object; + + public IScriptResolver ScriptResolver { get; } = new Mock(MockBehavior.Strict).Object; + + public IUpgradeScriptSequence UpgradeSequence { get; } = new Mock(MockBehavior.Strict).Object; + + public ICreateScriptSequence CreateSequence { get; } = new Mock(MockBehavior.Strict).Object; + + public EnvironmentBuilderMock WithLogger(ILogger logger) + { + _mock.Setup(b => b.WithLogger(logger)).Returns(_mock.Object); + _mockSequence.Add(nameof(IEnvironmentBuilder.WithLogger)); + return this; + } + + public EnvironmentBuilderMock WithConfiguration(string? configurationFile) + { + _mock.Setup(b => b.WithConfiguration(configurationFile)).Returns(_mock.Object); + _mockSequence.Add(nameof(IEnvironmentBuilder.WithConfiguration)); + return this; + } + + public EnvironmentBuilderMock WithPowerShellScripts(string? installationPath) + { + _mock.Setup(b => b.WithPowerShellScripts(installationPath)).Returns(_mock.Object); + _mockSequence.Add(nameof(IEnvironmentBuilder.WithPowerShellScripts)); + return this; + } + + public EnvironmentBuilderMock WithAssemblyScripts() + { + _mock.Setup(b => b.WithAssemblyScripts()).Returns(_mock.Object); + _mockSequence.Add(nameof(IEnvironmentBuilder.WithAssemblyScripts)); + return this; + } + + public EnvironmentBuilderMock WithVariables(IDictionary variables) + { + _mock.Setup(b => b.WithVariables(variables)).Returns(_mock.Object); + _mockSequence.Add(nameof(IEnvironmentBuilder.WithVariables)); + return this; + } + + public EnvironmentBuilderMock WithDataBase(string connectionString, TransactionMode transaction, bool whatIf) + { + _mock.Setup(b => b.WithDataBase(connectionString, transaction, whatIf)).Returns(_mock.Object); + _mockSequence.Add(nameof(IEnvironmentBuilder.WithDataBase)); + return this; + } + + public EnvironmentBuilderMock WithUpgradeSequence(IList scripts, bool folderAsModuleName) + { + _mock.Setup(b => b.BuildUpgradeSequence(scripts, folderAsModuleName)).Returns(UpgradeSequence); + _mockSequence.Add(nameof(IEnvironmentBuilder.BuildUpgradeSequence)); + return this; + } + + public EnvironmentBuilderMock WithCreateSequence(IList scripts) + { + _mock.Setup(b => b.BuildCreateSequence(scripts)).Returns(CreateSequence); + _mockSequence.Add(nameof(IEnvironmentBuilder.BuildCreateSequence)); + return this; + } + + public IEnvironmentBuilder Build() + { + _mock.Setup(b => b.BuildDatabase()).Returns(Database); + _mock.Setup(b => b.BuildScriptResolver()).Returns(ScriptResolver); + + return _mock.Object; + } + + public void VerifyAll() + { + _mock.VerifyAll(); + + var sequence = _mock + .Invocations + .Select(i => i.Method.Name) + .Where(i => i != nameof(IEnvironmentBuilder.BuildDatabase) && i != nameof(IEnvironmentBuilder.BuildScriptResolver)) + .ToArray(); + sequence.ShouldBe(_mockSequence); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Configuration/EnvironmentBuilderTest.cs b/Sources/SqlDatabase.Test/Configuration/EnvironmentBuilderTest.cs new file mode 100644 index 00000000..fc8e4477 --- /dev/null +++ b/Sources/SqlDatabase.Test/Configuration/EnvironmentBuilderTest.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using Moq; +using NUnit.Framework; +using Shouldly; +using SqlDatabase.Adapter; +using SqlDatabase.Scripts; + +namespace SqlDatabase.Configuration; + +[TestFixture] +public class EnvironmentBuilderTest +{ + private Mock _log = null!; + private AppConfiguration _configuration = null!; + private EnvironmentBuilder _sut = null!; + + [SetUp] + public void BeforeEachTest() + { + _log = new Mock(MockBehavior.Strict); + _configuration = new AppConfiguration(); + + _sut = new EnvironmentBuilder(); + + _sut + .WithConfiguration(_configuration) + .WithLogger(_log.Object); + } + + [Test] + public void CreateDatabase() + { + _sut + .WithDataBase("Data Source=.;Initial Catalog=SqlDatabaseTest", TransactionMode.PerStep, true) + .WithVariables(new Dictionary()); + + var actual = _sut.BuildDatabase().ShouldBeOfType(); + + actual.Log.ShouldBe(_log.Object); + actual.Adapter.ShouldNotBeNull(); + actual.Transaction.ShouldBe(TransactionMode.PerStep); + actual.WhatIf.ShouldBeTrue(); + } + + [Test] + public void CreateDatabaseApplyVariables() + { + var variables = new Dictionary + { + { "a", "1" }, + { "b", "2" } + }; + + _sut + .WithDataBase("Data Source=.;Initial Catalog=SqlDatabaseTest", TransactionMode.None, false) + .WithVariables(variables); + + _configuration.Variables.Add("b", "2.2"); + _configuration.Variables.Add("c", "3"); + + var actual = _sut.BuildDatabase().ShouldBeOfType(); + + actual.Variables.GetValue("a").ShouldBe("1"); + actual.Variables.GetValue("b").ShouldBe("2"); + actual.Variables.GetValue("c").ShouldBe("3"); + } + + [Test] + public void CreateDatabaseValidateVariables() + { + var variables = new Dictionary + { + { "a b", "1" } + }; + + _sut + .WithDataBase("Data Source=.;Initial Catalog=SqlDatabaseTest", TransactionMode.None, false) + .WithVariables(variables); + + _configuration.Variables.Add("c d", "1"); + + var ex = Assert.Throws(() => _sut.BuildDatabase()); + + ex!.Message.ShouldContain("a b"); + ex.Message.ShouldContain("c d"); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Configuration/ExecuteCommandLineTest.cs b/Sources/SqlDatabase.Test/Configuration/ExecuteCommandLineTest.cs index e8ad6fea..5ed2b3c9 100644 --- a/Sources/SqlDatabase.Test/Configuration/ExecuteCommandLineTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/ExecuteCommandLineTest.cs @@ -1,19 +1,18 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; using SqlDatabase.Commands; -using SqlDatabase.IO; -using SqlDatabase.Scripts; -using SqlDatabase.TestApi; +using SqlDatabase.FileSystem; namespace SqlDatabase.Configuration; [TestFixture] public class ExecuteCommandLineTest { - private Mock _log; - private Mock _fs; - private ExecuteCommandLine _sut; + private Mock _log = null!; + private Mock _fs = null!; + private ExecuteCommandLine _sut = null!; [SetUp] public void BeforeEachTest() @@ -74,20 +73,28 @@ public void Parse() public void CreateCommand() { _sut.WhatIf = true; - _sut.ConnectionString = MsSqlQuery.ConnectionString; + _sut.ConnectionString = "connection string"; + _sut.Transaction = TransactionMode.PerStep; _sut.UsePowerShell = @"c:\PowerShell"; + var builder = new EnvironmentBuilderMock() + .WithLogger(_log.Object) + .WithConfiguration(_sut.ConfigurationFile) + .WithPowerShellScripts(_sut.UsePowerShell) + .WithAssemblyScripts() + .WithVariables(_sut.Variables) + .WithDataBase(_sut.ConnectionString, _sut.Transaction, _sut.WhatIf) + .WithCreateSequence(_sut.Scripts); + var actual = _sut - .CreateCommand(_log.Object) + .CreateCommand(_log.Object, builder.Build()) .ShouldBeOfType(); - actual.Log.ShouldBe(_log.Object); - var database = actual.Database.ShouldBeOfType(); - database.WhatIf.ShouldBeTrue(); - - var scriptFactory = actual.ScriptSequence.ShouldBeOfType().ScriptFactory.ShouldBeOfType(); - scriptFactory.PowerShellFactory.InstallationPath.ShouldBe(@"c:\PowerShell"); + builder.VerifyAll(); - actual.PowerShellFactory.ShouldBe(scriptFactory.PowerShellFactory); + actual.Log.ShouldBe(_log.Object); + actual.Database.ShouldBe(builder.Database); + actual.ScriptResolver.ShouldBe(builder.ScriptResolver); + actual.ScriptSequence.ShouldBe(builder.CreateSequence); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Configuration/ExportCommandLineTest.cs b/Sources/SqlDatabase.Test/Configuration/ExportCommandLineTest.cs index 5e0538c5..39d8986e 100644 --- a/Sources/SqlDatabase.Test/Configuration/ExportCommandLineTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/ExportCommandLineTest.cs @@ -2,10 +2,10 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; +using SqlDatabase.Adapter.Sql.Export; using SqlDatabase.Commands; -using SqlDatabase.Export; -using SqlDatabase.IO; -using SqlDatabase.Scripts; +using SqlDatabase.FileSystem; using SqlDatabase.TestApi; namespace SqlDatabase.Configuration; @@ -13,9 +13,9 @@ namespace SqlDatabase.Configuration; [TestFixture] public class ExportCommandLineTest { - private Mock _log; - private Mock _fs; - private ExportCommandLine _sut; + private Mock _log = null!; + private Mock _fs = null!; + private ExportCommandLine _sut = null!; [SetUp] public void BeforeEachTest() @@ -57,16 +57,26 @@ public void Parse() [Test] public void CreateCommand() { - _sut.ConnectionString = MsSqlQuery.ConnectionString; + _sut.ConnectionString = "connection string"; _sut.DestinationTableName = "table 1"; + var builder = new EnvironmentBuilderMock() + .WithLogger(_log.Object) + .WithConfiguration(_sut.ConfigurationFile) + .WithVariables(_sut.Variables) + .WithDataBase(_sut.ConnectionString, TransactionMode.None, false) + .WithCreateSequence(_sut.Scripts); + var actual = _sut - .CreateCommand(_log.Object) + .CreateCommand(_log.Object, builder.Build()) .ShouldBeOfType(); + builder.VerifyAll(); + actual.Log.ShouldNotBe(_log.Object); - actual.Database.ShouldBeOfType(); - actual.ScriptSequence.ShouldBeOfType(); + actual.Database.ShouldBe(builder.Database); + actual.ScriptResolver.ShouldBe(builder.ScriptResolver); + actual.ScriptSequence.ShouldBe(builder.CreateSequence); actual.OpenOutput.ShouldNotBeNull(); actual.DestinationTableName.ShouldBe("table 1"); } diff --git a/Sources/SqlDatabase.Test/Configuration/GenericCommandLineBuilderTest.cs b/Sources/SqlDatabase.Test/Configuration/GenericCommandLineBuilderTest.cs index 9f176ed8..016a2772 100644 --- a/Sources/SqlDatabase.Test/Configuration/GenericCommandLineBuilderTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/GenericCommandLineBuilderTest.cs @@ -1,13 +1,13 @@ -using System; -using NUnit.Framework; +using NUnit.Framework; using Shouldly; +using SqlDatabase.TestApi; namespace SqlDatabase.Configuration; [TestFixture] public class GenericCommandLineBuilderTest { - private GenericCommandLineBuilder _sut; + private GenericCommandLineBuilder _sut = null!; [SetUp] public void BeforeEachTest() @@ -33,7 +33,7 @@ public void BuildArray() foreach (var arg in args) { - Console.WriteLine(arg); + TestOutput.WriteLine(arg); } CommandLineParser.GetLogFileName(args).ShouldBe("log file"); diff --git a/Sources/SqlDatabase.Test/Configuration/UpgradeCommandLineTest.cs b/Sources/SqlDatabase.Test/Configuration/UpgradeCommandLineTest.cs index 58abace4..e2bb4077 100644 --- a/Sources/SqlDatabase.Test/Configuration/UpgradeCommandLineTest.cs +++ b/Sources/SqlDatabase.Test/Configuration/UpgradeCommandLineTest.cs @@ -1,19 +1,18 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; using SqlDatabase.Commands; -using SqlDatabase.IO; -using SqlDatabase.Scripts; -using SqlDatabase.TestApi; +using SqlDatabase.FileSystem; namespace SqlDatabase.Configuration; [TestFixture] public class UpgradeCommandLineTest { - private Mock _log; - private Mock _fs; - private UpgradeCommandLine _sut; + private Mock _log = null!; + private Mock _fs = null!; + private UpgradeCommandLine _sut = null!; [SetUp] public void BeforeEachTest() @@ -70,24 +69,28 @@ public void CreateCommand() { _sut.WhatIf = true; _sut.FolderAsModuleName = true; - _sut.ConnectionString = MsSqlQuery.ConnectionString; + _sut.Transaction = TransactionMode.PerStep; + _sut.ConnectionString = "connection string"; _sut.UsePowerShell = @"c:\PowerShell"; + var builder = new EnvironmentBuilderMock() + .WithLogger(_log.Object) + .WithConfiguration(_sut.ConfigurationFile) + .WithPowerShellScripts(_sut.UsePowerShell) + .WithAssemblyScripts() + .WithVariables(_sut.Variables) + .WithDataBase(_sut.ConnectionString, _sut.Transaction, _sut.WhatIf) + .WithUpgradeSequence(_sut.Scripts, _sut.FolderAsModuleName); + var actual = _sut - .CreateCommand(_log.Object) + .CreateCommand(_log.Object, builder.Build()) .ShouldBeOfType(); - actual.Log.ShouldBe(_log.Object); - var database = actual.Database.ShouldBeOfType(); - database.WhatIf.ShouldBeTrue(); - - var sequence = actual.ScriptSequence.ShouldBeOfType(); - sequence.WhatIf.ShouldBeTrue(); - sequence.FolderAsModuleName.ShouldBeTrue(); + builder.VerifyAll(); - var scriptFactory = sequence.ScriptFactory.ShouldBeOfType(); - scriptFactory.PowerShellFactory.InstallationPath.ShouldBe(@"c:\PowerShell"); - - actual.PowerShellFactory.ShouldBe(scriptFactory.PowerShellFactory); + actual.Log.ShouldBe(_log.Object); + actual.Database.ShouldBe(builder.Database); + actual.ScriptResolver.ShouldBe(builder.ScriptResolver); + actual.ScriptSequence.ShouldBe(builder.UpgradeSequence); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Docker/docker-compose.yml b/Sources/SqlDatabase.Test/Docker/docker-compose.yml deleted file mode 100644 index 74dfe60f..00000000 --- a/Sources/SqlDatabase.Test/Docker/docker-compose.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: "3" -services: - mssql: - image: mcr.microsoft.com/mssql/server:latest - restart: always - environment: - - ACCEPT_EULA=Y - - SA_PASSWORD=P@ssw0rd - - MSSQL_PID=Express - volumes: - - ./:/usr/src/app - ports: - - 1433:1433 - working_dir: /usr/src/app - command: bash -c ' chmod +x ./mssql.entrypoint.sh; ./mssql.entrypoint.sh & /opt/mssql/bin/sqlservr;' - - pgsql: - image: postgres:latest - restart: always - environment: - POSTGRES_PASSWORD: qwerty - volumes: - - ./pgsql.create-database.sql:/docker-entrypoint-initdb.d/pgsql.create-database.sql - ports: - - 5432:5432 - - mysql: - image: mysql:latest - restart: always - environment: - MYSQL_ROOT_PASSWORD: qwerty - volumes: - - ./mysql.create-database.sql:/docker-entrypoint-initdb.d/mysql.create-database.sql - ports: - - 3306:3306 diff --git a/Sources/SqlDatabase.Test/Docker/mssql.entrypoint.sh b/Sources/SqlDatabase.Test/Docker/mssql.entrypoint.sh deleted file mode 100644 index a1a3147a..00000000 --- a/Sources/SqlDatabase.Test/Docker/mssql.entrypoint.sh +++ /dev/null @@ -1,5 +0,0 @@ -# wait for SQL Server to come up -sleep 5s - -# create database -/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P P@ssw0rd -l 60 -i ./mssql.create-database.sql \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Export/notes.txt b/Sources/SqlDatabase.Test/Export/notes.txt deleted file mode 100644 index 7ac9205a..00000000 --- a/Sources/SqlDatabase.Test/Export/notes.txt +++ /dev/null @@ -1,60 +0,0 @@ -ColumnName: Id -ColumnOrdinal: 0 -DataTypeName: int -DataType: int32 -AllowDBNull: false -ColumnSize: 4 - - Key "DataTypeName" string - - [0] "ColumnName" string - [1] "ColumnOrdinal" string - [2] "ColumnSize" string - [3] "NumericPrecision" string - [4] "NumericScale" string - [5] "IsUnique" string - [6] "IsKey" string - [7] "BaseServerName" string - [8] "BaseCatalogName" string - [9] "BaseColumnName" string - [10] "BaseSchemaName" string - [11] "BaseTableName" string - [12] "DataType" string - [13] "AllowDBNull" string - [14] "ProviderType" string - [15] "IsAliased" string - [16] "IsExpression" string - [17] "IsIdentity" string - [18] "IsAutoIncrement" string - [19] "IsRowVersion" string - [20] "IsHidden" string - [21] "IsLong" string - [22] "IsReadOnly" string - [23] "ProviderSpecificDataType" string - [24] "DataTypeName" string - [25] "XmlSchemaCollectionDatabase" string - [26] "XmlSchemaCollectionOwningSchema" string - [27] "XmlSchemaCollectionName" string - [28] "UdtAssemblyQualifiedName" string - [29] "NonVersionedProviderType" string - [30] "IsColumnSet" string - ------------------------------------ - -ScriptFactory - SqlStringFile : IFileSystemInfo - File : IFileSystemInfo - ZipFile : IFileSystemInfo - -CommandFactory - string => ISystemInfo - sql string => SqlStringFile - -Database.Execute - IScript.Execute(command) - -Create/Update/Execute - IScript.Execute(command) - -Export - IScript.Export(command, TextWriter output) \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/ProgramTest.cs b/Sources/SqlDatabase.Test/IntegrationTests/MsSql/ProgramTest.cs deleted file mode 100644 index 5fec0140..00000000 --- a/Sources/SqlDatabase.Test/IntegrationTests/MsSql/ProgramTest.cs +++ /dev/null @@ -1,276 +0,0 @@ -using System; -using System.Data.SqlClient; -using System.IO; -using System.Linq; -using Dapper; -using Moq; -using NUnit.Framework; -using Shouldly; -using SqlDatabase.Configuration; -using SqlDatabase.Scripts; -using SqlDatabase.Scripts.MsSql; -using SqlDatabase.TestApi; -using ConfigurationManager = System.Configuration.ConfigurationManager; - -namespace SqlDatabase.IntegrationTests.MsSql; - -[TestFixture] -public class ProgramTest -{ - private readonly string _connectionString = new SqlConnectionStringBuilder(MsSqlQuery.ConnectionString) { InitialCatalog = "SqlDatabaseIT" }.ToString(); - - private string _scriptsLocation; - private AppConfiguration _configuration; - private TempFile _logFile; - - [SetUp] - public void BeforeEachTest() - { - TestPowerShellHost.GetOrCreateFactory(); - - _scriptsLocation = ConfigurationManager.AppSettings["MsSql.IntegrationTestsScriptsLocation"]; - if (!Path.IsPathRooted(_scriptsLocation)) - { - _scriptsLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _scriptsLocation); - } - - _configuration = new AppConfiguration(); - - _logFile = new TempFile(".log"); - } - - [TearDown] - public void AfterEachTest() - { - FileAssert.Exists(_logFile.Location); - var fileContent = File.ReadAllLines(_logFile.Location); - _logFile.Dispose(); - - fileContent.ShouldNotBeEmpty(); - } - - [Test] - [Order(1)] - - public void CreateDatabase() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandCreate) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "new")) - .SetVariable("JohnCity", "London") - .SetVariable("MariaCity", "Paris") - .SetLogFileName(_logFile.Location) - .BuildArray(); - - Assert.AreEqual(0, Program.Main(args)); - - const string Sql = @" -SELECT Person.Id, Person.Name, PersonAddress.City -FROM demo.Person Person - INNER JOIN demo.PersonAddress PersonAddress ON (PersonAddress.PersonId = Person.Id) -ORDER BY Person.Id"; - - Assert.AreEqual(new Version("1.2"), CreateDatabaseObject().GetCurrentVersion(null)); - - using (var c = new SqlConnection(_connectionString)) - { - c.Open(); - var rows = c.Query(Sql).ToList(); - Assert.AreEqual(2, rows.Count); - - Assert.AreEqual(1, rows[0].Id); - Assert.AreEqual("John", rows[0].Name); - Assert.AreEqual("London", rows[0].City); - - Assert.AreEqual(2, rows[1].Id); - Assert.AreEqual("Maria", rows[1].Name); - Assert.AreEqual("Paris", rows[1].City); - } - } - - [Test] - [Order(2)] - public void UpgradeDatabase() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandUpgrade) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "upgrade")) - .SetConfigurationFile(Path.Combine(_scriptsLocation, "Upgrade", "SqlDatabase.exe.config")) - .SetVariable("JohnSecondName", "Smitt") - .SetVariable("MariaSecondName", "X") - .SetLogFileName(_logFile.Location) - .BuildArray(); - - Assert.AreEqual(0, Program.Main(args)); - - const string Sql = @" -SELECT Person.Id, Person.SecondName -FROM demo.Person Person -ORDER BY Person.Id"; - - Assert.AreEqual(new Version("2.1"), CreateDatabaseObject().GetCurrentVersion(null)); - - using (var c = new SqlConnection(_connectionString)) - { - c.Open(); - var rows = c.Query(Sql).ToList(); - Assert.AreEqual(2, rows.Count); - - Assert.AreEqual(1, rows[0].Id); - Assert.AreEqual("Smitt", rows[0].SecondName); - - Assert.AreEqual(2, rows[1].Id); - Assert.AreEqual("X", rows[1].SecondName); - } - } - - [Test] - [Order(3)] - public void UpgradeDatabaseModularity() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandUpgrade) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "UpgradeModularity")) - .SetConfigurationFile(Path.Combine(_scriptsLocation, "UpgradeModularity", "SqlDatabase.exe.config")) - .SetLogFileName(_logFile.Location); - - Program.Main(args.BuildArray()).ShouldBe(0); - - const string Sql = @" -SELECT p.Name, a.City -FROM moduleA.Person p - LEFT JOIN moduleB.PersonAddress a ON a.PersonId = p.Id -ORDER BY p.Name"; - - var configuration = new SqlDatabase.Configuration.ConfigurationManager(); - configuration.LoadFrom(args.Line.ConfigurationFile); - - var db = CreateDatabaseObject(configuration.SqlDatabase); - db.GetCurrentVersion("ModuleA").ShouldBe(new Version("2.0")); - db.GetCurrentVersion("ModuleB").ShouldBe(new Version("1.1")); - db.GetCurrentVersion("ModuleC").ShouldBe(new Version("2.0")); - - using (var c = new SqlConnection(_connectionString)) - { - c.Open(); - var rows = c.Query(Sql).ToList(); - rows.Count.ShouldBe(2); - - Assert.AreEqual("John", rows[0].Name); - Assert.AreEqual("London", rows[0].City); - - Assert.AreEqual("Maria", rows[1].Name); - Assert.IsNull(rows[1].City); - } - } - - [Test] - [Order(4)] - public void ExportDataToConsole() - { - // export - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExport) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, @"Export\export.sql")) - .SetExportToTable("dbo.ExportedData1") - .BuildArray(); - - int exitCode; - string output; - using (var console = new TempConsoleOut()) - { - exitCode = Program.Main(args); - output = console.GetOutput(); - } - - Console.WriteLine(output); - exitCode.ShouldBe(0); - - // exec - InvokeExecuteCommand(b => b.SetInLineScript(output)); - - // test - using (var c = new SqlConnection(_connectionString)) - { - c.Open(); - - var test = c.ExecuteScalar("SELECT COUNT(1) FROM dbo.ExportedData1"); - test.ShouldBe(2); - } - } - - [Test] - [Order(5)] - public void ExportDataToFile() - { - using (var output = new TempFile(".sql")) - { - // export - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExport) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, @"Export\export.sql")) - .SetExportToTable("dbo.ExportedData2") - .SetExportToFile(output.Location) - .BuildArray(); - - Program.Main(args).ShouldBe(0); - Console.WriteLine(File.ReadAllText(output.Location)); - - // exec - InvokeExecuteCommand(b => b.SetScripts(output.Location)); - } - - // test - using (var c = new SqlConnection(_connectionString)) - { - c.Open(); - - var test = c.ExecuteScalar("SELECT COUNT(1) FROM dbo.ExportedData2"); - test.ShouldBe(2); - } - } - - [Test] - [Order(6)] - public void ExecuteScript() - { - InvokeExecuteCommand(b => - b.SetScripts(Path.Combine(_scriptsLocation, "execute", "drop.database.sql"))); - - var sql = "SELECT DB_ID('{0}')".FormatWith(new SqlConnectionStringBuilder(_connectionString).InitialCatalog); - - using (var c = new SqlConnection(MsSqlQuery.ConnectionString)) - { - c.Open(); - - var test = c.ExecuteScalar(sql); - Assert.IsNull(test); - } - } - - private void InvokeExecuteCommand(Action builder) - { - var cmd = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExecute) - .SetConnection(_connectionString) - .SetLogFileName(_logFile.Location); - - builder(cmd); - var args = cmd.BuildArray(); - - Program.Main(args).ShouldBe(0); - } - - private IDatabase CreateDatabaseObject(AppConfiguration configuration = null) - { - return new Database - { - Adapter = new MsSqlDatabaseAdapter(_connectionString, configuration ?? _configuration, new Mock(MockBehavior.Strict).Object) - }; - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/IntegrationTests/MySql/ProgramTest.cs b/Sources/SqlDatabase.Test/IntegrationTests/MySql/ProgramTest.cs deleted file mode 100644 index b02b765d..00000000 --- a/Sources/SqlDatabase.Test/IntegrationTests/MySql/ProgramTest.cs +++ /dev/null @@ -1,277 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using Dapper; -using Moq; -using MySqlConnector; -using NUnit.Framework; -using Shouldly; -using SqlDatabase.Configuration; -using SqlDatabase.Scripts; -using SqlDatabase.Scripts.MySql; -using SqlDatabase.TestApi; -using ConfigurationManager = System.Configuration.ConfigurationManager; - -namespace SqlDatabase.IntegrationTests.MySql; - -[TestFixture] -public class ProgramTest -{ - private readonly string _connectionString = new MySqlConnectionStringBuilder(MySqlQuery.ConnectionString) { Database = "sqldatabasetest_it" }.ToString(); - - private string _scriptsLocation; - private AppConfiguration _configuration; - private TempFile _logFile; - - [SetUp] - public void BeforeEachTest() - { - TestPowerShellHost.GetOrCreateFactory(); - - _scriptsLocation = ConfigurationManager.AppSettings["MySql.IntegrationTestsScriptsLocation"]; - if (!Path.IsPathRooted(_scriptsLocation)) - { - _scriptsLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _scriptsLocation); - } - - _configuration = new AppConfiguration(); - - _logFile = new TempFile(".log"); - } - - [TearDown] - public void AfterEachTest() - { - FileAssert.Exists(_logFile.Location); - var fileContent = File.ReadAllLines(_logFile.Location); - _logFile.Dispose(); - - fileContent.ShouldNotBeEmpty(); - } - - [Test] - [Order(1)] - - public void CreateDatabase() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandCreate) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "new")) - .SetVariable("JohnCity", "London") - .SetVariable("MariaCity", "Paris") - .SetLogFileName(_logFile.Location) - .BuildArray(); - - Program.Main(args).ShouldBe(0); - - const string Sql = @" -SELECT person.id, person.name, person_address.city -FROM person person - INNER JOIN person_address person_address ON (person_address.person_id = person.id) -ORDER BY person.id"; - - CreateDatabaseObject().GetCurrentVersion(null).ShouldBe(new Version("1.2")); - - using (var c = new MySqlConnection(_connectionString)) - { - c.Open(); - - var rows = c.Query(Sql).ToList(); - Assert.AreEqual(2, rows.Count); - - Assert.AreEqual(1, rows[0].id); - Assert.AreEqual("John", rows[0].name); - Assert.AreEqual("London", rows[0].city); - - Assert.AreEqual(2, rows[1].id); - Assert.AreEqual("Maria", rows[1].name); - Assert.AreEqual("Paris", rows[1].city); - } - } - - [Test] - [Order(2)] - public void UpgradeDatabase() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandUpgrade) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "upgrade")) - .SetConfigurationFile(Path.Combine(_scriptsLocation, "Upgrade", "SqlDatabase.exe.config")) - .SetVariable("JohnSecondName", "Smitt") - .SetVariable("MariaSecondName", "X") - .SetLogFileName(_logFile.Location) - .BuildArray(); - - Program.Main(args).ShouldBe(0); - - const string Sql = @" -SELECT person.id, person.second_name -FROM person person -ORDER BY person.id"; - - CreateDatabaseObject().GetCurrentVersion(null).ShouldBe(new Version("2.1")); - - using (var c = new MySqlConnection(_connectionString)) - { - c.Open(); - var rows = c.Query(Sql).ToList(); - Assert.AreEqual(2, rows.Count); - - Assert.AreEqual(1, rows[0].id); - Assert.AreEqual("Smitt", rows[0].second_name); - - Assert.AreEqual(2, rows[1].id); - Assert.AreEqual("X", rows[1].second_name); - } - } - - [Test] - [Order(3)] - public void UpgradeDatabaseModularity() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandUpgrade) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "UpgradeModularity")) - .SetConfigurationFile(Path.Combine(_scriptsLocation, "UpgradeModularity", "SqlDatabase.exe.config")) - .SetLogFileName(_logFile.Location); - - Program.Main(args.BuildArray()).ShouldBe(0); - - const string Sql = @" -SELECT p.name, a.city -FROM module_a_person p - LEFT JOIN module_b_person_address a ON a.person_id = p.id -ORDER BY p.name"; - - var configuration = new SqlDatabase.Configuration.ConfigurationManager(); - configuration.LoadFrom(args.Line.ConfigurationFile); - - var db = CreateDatabaseObject(configuration.SqlDatabase); - db.GetCurrentVersion("ModuleA").ShouldBe(new Version("2.0")); - db.GetCurrentVersion("ModuleB").ShouldBe(new Version("1.1")); - db.GetCurrentVersion("ModuleC").ShouldBe(new Version("2.0")); - - using (var c = new MySqlConnection(_connectionString)) - { - c.Open(); - var rows = c.Query(Sql).ToList(); - rows.Count.ShouldBe(2); - - Assert.AreEqual("John", rows[0].name); - Assert.AreEqual("London", rows[0].city); - - Assert.AreEqual("Maria", rows[1].name); - Assert.IsNull(rows[1].city); - } - } - - [Test] - [Order(4)] - public void ExportDataToConsole() - { - // export - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExport) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, @"Export\export.sql")) - .SetExportToTable("exported_data1") - .BuildArray(); - - int exitCode; - string output; - using (var console = new TempConsoleOut()) - { - exitCode = Program.Main(args); - output = console.GetOutput(); - } - - Console.WriteLine(output); - exitCode.ShouldBe(0); - - // exec - InvokeExecuteCommand(b => b.SetInLineScript(output)); - - // test - using (var c = new MySqlConnection(_connectionString)) - { - c.Open(); - - var test = c.ExecuteScalar("SELECT COUNT(1) FROM exported_data1"); - test.ShouldBe(2); - } - } - - [Test] - [Order(5)] - public void ExportDataToFile() - { - using (var output = new TempFile(".sql")) - { - // export - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExport) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, @"Export\export.sql")) - .SetExportToTable("exported_data2") - .SetExportToFile(output.Location) - .BuildArray(); - - Program.Main(args).ShouldBe(0); - Console.WriteLine(File.ReadAllText(output.Location)); - - // exec - InvokeExecuteCommand(b => b.SetScripts(output.Location)); - } - - // test - using (var c = new MySqlConnection(_connectionString)) - { - c.Open(); - - var test = c.ExecuteScalar("SELECT COUNT(1) FROM exported_data2"); - test.ShouldBe(2); - } - } - - [Test] - [Order(6)] - public void ExecuteScript() - { - InvokeExecuteCommand(b => - b.SetScripts(Path.Combine(_scriptsLocation, "execute", "drop.database.ps1"))); - - var sql = "SELECT 1 FROM information_schema.schemata WHERE LOWER(schema_name) = LOWER('{0}')".FormatWith(new MySqlConnectionStringBuilder(_connectionString).Database); - - using (var c = new MySqlConnection(MySqlQuery.ConnectionString)) - { - c.Open(); - - var test = c.ExecuteScalar(sql); - Assert.IsNull(test); - } - } - - private void InvokeExecuteCommand(Action builder) - { - var cmd = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExecute) - .SetConnection(_connectionString) - .SetLogFileName(_logFile.Location); - - builder(cmd); - var args = cmd.BuildArray(); - - Program.Main(args).ShouldBe(0); - } - - private IDatabase CreateDatabaseObject(AppConfiguration configuration = null) - { - return new Database - { - Adapter = new MySqlDatabaseAdapter(_connectionString, configuration ?? _configuration, new Mock(MockBehavior.Strict).Object) - }; - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/ProgramTest.cs b/Sources/SqlDatabase.Test/IntegrationTests/PgSql/ProgramTest.cs deleted file mode 100644 index dbd52775..00000000 --- a/Sources/SqlDatabase.Test/IntegrationTests/PgSql/ProgramTest.cs +++ /dev/null @@ -1,277 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using Dapper; -using Moq; -using Npgsql; -using NUnit.Framework; -using Shouldly; -using SqlDatabase.Configuration; -using SqlDatabase.Scripts; -using SqlDatabase.Scripts.PgSql; -using SqlDatabase.TestApi; -using ConfigurationManager = System.Configuration.ConfigurationManager; - -namespace SqlDatabase.IntegrationTests.PgSql; - -[TestFixture] -public class ProgramTest -{ - private readonly string _connectionString = new NpgsqlConnectionStringBuilder(PgSqlQuery.ConnectionString) { Database = "sqldatabasetest_it" }.ToString(); - - private string _scriptsLocation; - private AppConfiguration _configuration; - private TempFile _logFile; - - [SetUp] - public void BeforeEachTest() - { - TestPowerShellHost.GetOrCreateFactory(); - - _scriptsLocation = ConfigurationManager.AppSettings["PgSql.IntegrationTestsScriptsLocation"]; - if (!Path.IsPathRooted(_scriptsLocation)) - { - _scriptsLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _scriptsLocation); - } - - _configuration = new AppConfiguration(); - - _logFile = new TempFile(".log"); - } - - [TearDown] - public void AfterEachTest() - { - FileAssert.Exists(_logFile.Location); - var fileContent = File.ReadAllLines(_logFile.Location); - _logFile.Dispose(); - - fileContent.ShouldNotBeEmpty(); - } - - [Test] - [Order(1)] - - public void CreateDatabase() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandCreate) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "new")) - .SetVariable("JohnCity", "London") - .SetVariable("MariaCity", "Paris") - .SetLogFileName(_logFile.Location) - .BuildArray(); - - Program.Main(args).ShouldBe(0); - - const string Sql = @" -SELECT person.id, person.name, person_address.city -FROM demo.person person - INNER JOIN demo.person_address person_address ON (person_address.person_id = person.id) -ORDER BY person.id"; - - CreateDatabaseObject().GetCurrentVersion(null).ShouldBe(new Version("1.2")); - - using (var c = new NpgsqlConnection(_connectionString)) - { - c.Open(); - - var rows = c.Query(Sql).ToList(); - Assert.AreEqual(2, rows.Count); - - Assert.AreEqual(1, rows[0].id); - Assert.AreEqual("John", rows[0].name); - Assert.AreEqual("London", rows[0].city); - - Assert.AreEqual(2, rows[1].id); - Assert.AreEqual("Maria", rows[1].name); - Assert.AreEqual("Paris", rows[1].city); - } - } - - [Test] - [Order(2)] - public void UpgradeDatabase() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandUpgrade) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "upgrade")) - .SetConfigurationFile(Path.Combine(_scriptsLocation, "Upgrade", "SqlDatabase.exe.config")) - .SetVariable("JohnSecondName", "Smitt") - .SetVariable("MariaSecondName", "X") - .SetLogFileName(_logFile.Location) - .BuildArray(); - - Program.Main(args).ShouldBe(0); - - const string Sql = @" -SELECT person.id, person.second_name -FROM demo.person person -ORDER BY person.id"; - - CreateDatabaseObject().GetCurrentVersion(null).ShouldBe(new Version("2.1")); - - using (var c = new NpgsqlConnection(_connectionString)) - { - c.Open(); - var rows = c.Query(Sql).ToList(); - Assert.AreEqual(2, rows.Count); - - Assert.AreEqual(1, rows[0].id); - Assert.AreEqual("Smitt", rows[0].second_name); - - Assert.AreEqual(2, rows[1].id); - Assert.AreEqual("X", rows[1].second_name); - } - } - - [Test] - [Order(3)] - public void UpgradeDatabaseModularity() - { - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandUpgrade) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, "UpgradeModularity")) - .SetConfigurationFile(Path.Combine(_scriptsLocation, "UpgradeModularity", "SqlDatabase.exe.config")) - .SetLogFileName(_logFile.Location); - - Program.Main(args.BuildArray()).ShouldBe(0); - - const string Sql = @" -SELECT p.name, a.city -FROM module_a.person p - LEFT JOIN module_b.person_address a ON a.person_id = p.id -ORDER BY p.name"; - - var configuration = new SqlDatabase.Configuration.ConfigurationManager(); - configuration.LoadFrom(args.Line.ConfigurationFile); - - var db = CreateDatabaseObject(configuration.SqlDatabase); - db.GetCurrentVersion("ModuleA").ShouldBe(new Version("2.0")); - db.GetCurrentVersion("ModuleB").ShouldBe(new Version("1.1")); - db.GetCurrentVersion("ModuleC").ShouldBe(new Version("2.0")); - - using (var c = new NpgsqlConnection(_connectionString)) - { - c.Open(); - var rows = c.Query(Sql).ToList(); - rows.Count.ShouldBe(2); - - Assert.AreEqual("John", rows[0].name); - Assert.AreEqual("London", rows[0].city); - - Assert.AreEqual("Maria", rows[1].name); - Assert.IsNull(rows[1].city); - } - } - - [Test] - [Order(4)] - public void ExportDataToConsole() - { - // export - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExport) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, @"Export\export.sql")) - .SetExportToTable("public.exported_data1") - .BuildArray(); - - int exitCode; - string output; - using (var console = new TempConsoleOut()) - { - exitCode = Program.Main(args); - output = console.GetOutput(); - } - - Console.WriteLine(output); - exitCode.ShouldBe(0); - - // exec - InvokeExecuteCommand(b => b.SetInLineScript(output)); - - // test - using (var c = new NpgsqlConnection(_connectionString)) - { - c.Open(); - - var test = c.ExecuteScalar("SELECT COUNT(1) FROM public.exported_data1"); - test.ShouldBe(2); - } - } - - [Test] - [Order(5)] - public void ExportDataToFile() - { - using (var output = new TempFile(".sql")) - { - // export - var args = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExport) - .SetConnection(_connectionString) - .SetScripts(Path.Combine(_scriptsLocation, @"Export\export.sql")) - .SetExportToTable("public.exported_data2") - .SetExportToFile(output.Location) - .BuildArray(); - - Program.Main(args).ShouldBe(0); - Console.WriteLine(File.ReadAllText(output.Location)); - - // exec - InvokeExecuteCommand(b => b.SetScripts(output.Location)); - } - - // test - using (var c = new NpgsqlConnection(_connectionString)) - { - c.Open(); - - var test = c.ExecuteScalar("SELECT COUNT(1) FROM public.exported_data2"); - test.ShouldBe(2); - } - } - - [Test] - [Order(6)] - public void ExecuteScript() - { - InvokeExecuteCommand(b => - b.SetScripts(Path.Combine(_scriptsLocation, "execute", "drop.database.ps1"))); - - var sql = "SELECT 1 FROM PG_DATABASE WHERE LOWER(DATNAME) = LOWER('{0}')".FormatWith(new NpgsqlConnectionStringBuilder(_connectionString).Database); - - using (var c = new NpgsqlConnection(PgSqlQuery.ConnectionString)) - { - c.Open(); - - var test = c.ExecuteScalar(sql); - Assert.IsNull(test); - } - } - - private void InvokeExecuteCommand(Action builder) - { - var cmd = new GenericCommandLineBuilder() - .SetCommand(CommandLineFactory.CommandExecute) - .SetConnection(_connectionString) - .SetLogFileName(_logFile.Location); - - builder(cmd); - var args = cmd.BuildArray(); - - Program.Main(args).ShouldBe(0); - } - - private IDatabase CreateDatabaseObject(AppConfiguration configuration = null) - { - return new Database - { - Adapter = new PgSqlDatabaseAdapter(_connectionString, configuration ?? _configuration, new Mock(MockBehavior.Strict).Object) - }; - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Log/CombinedLoggerTest.cs b/Sources/SqlDatabase.Test/Log/CombinedLoggerTest.cs index 665bf7b4..5e887bb0 100644 --- a/Sources/SqlDatabase.Test/Log/CombinedLoggerTest.cs +++ b/Sources/SqlDatabase.Test/Log/CombinedLoggerTest.cs @@ -2,15 +2,16 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; namespace SqlDatabase.Log; [TestFixture] public class CombinedLoggerTest { - private CombinedLogger _sut; - private Mock _logger1; - private Mock _logger2; + private CombinedLogger _sut = null!; + private Mock _logger1 = null!; + private Mock _logger2 = null!; public interface IDisposableLogger : ILogger, IDisposable { diff --git a/Sources/SqlDatabase.Test/Log/FileLoggerTest.cs b/Sources/SqlDatabase.Test/Log/FileLoggerTest.cs index 7cd4e8b0..27b373cb 100644 --- a/Sources/SqlDatabase.Test/Log/FileLoggerTest.cs +++ b/Sources/SqlDatabase.Test/Log/FileLoggerTest.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using System.IO; using NUnit.Framework; using Shouldly; using SqlDatabase.TestApi; @@ -9,7 +8,7 @@ namespace SqlDatabase.Log; [TestFixture] public class FileLoggerTest { - private TempFile _file; + private TempFile _file = null!; [SetUp] public void BeforeEachTest() @@ -33,7 +32,7 @@ public void Info() var actual = File.ReadAllText(_file.Location); - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldContain(" INFO "); actual.ShouldContain(" some message"); } @@ -48,7 +47,7 @@ public void Error() var actual = File.ReadAllText(_file.Location); - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldContain(" ERROR "); actual.ShouldContain(" some message"); } @@ -66,7 +65,7 @@ public void Append() var actual = File.ReadAllText(_file.Location); - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldContain("do not remove"); actual.ShouldContain(" INFO "); actual.ShouldContain(" some message"); @@ -90,7 +89,7 @@ public void FileIsAvailableForRead() } } - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldContain(" INFO "); actual.ShouldContain(" some message"); } @@ -105,7 +104,7 @@ public void WriteNull() var actual = File.ReadAllText(_file.Location); - Console.WriteLine(actual); + TestOutput.WriteLine(actual); actual.ShouldContain(" INFO "); } } \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Log/LoggerBaseTest.cs b/Sources/SqlDatabase.Test/Log/LoggerBaseTest.cs index 09d27d13..09cef943 100644 --- a/Sources/SqlDatabase.Test/Log/LoggerBaseTest.cs +++ b/Sources/SqlDatabase.Test/Log/LoggerBaseTest.cs @@ -8,9 +8,9 @@ namespace SqlDatabase.Log; [TestFixture] public class LoggerBaseTest { - private IList _info; - private IList _error; - private LoggerBase _sut; + private IList _info = null!; + private IList _error = null!; + private LoggerBase _sut = null!; [SetUp] public void BeforeEachTest() diff --git a/Sources/SqlDatabase.Test/Properties/AssemblyInfo.cs b/Sources/SqlDatabase.Test/Properties/AssemblyInfo.cs index b25181af..5f282702 100644 --- a/Sources/SqlDatabase.Test/Properties/AssemblyInfo.cs +++ b/Sources/SqlDatabase.Test/Properties/AssemblyInfo.cs @@ -1,6 +1 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SqlDatabase.Test")] -[assembly: AssemblyDescription("")] -[assembly: Guid("615bdfb2-2b5a-4758-ba70-ee93d22ead7d")] + \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/Net452/Net452SubDomainTest.StepWithSubDomain.cs b/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/Net452/Net452SubDomainTest.StepWithSubDomain.cs deleted file mode 100644 index c1552f81..00000000 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/Net452/Net452SubDomainTest.StepWithSubDomain.cs +++ /dev/null @@ -1,67 +0,0 @@ -#if NET472 -using System; -using System.Data; -using System.IO; -using SqlDatabase.TestApi; - -namespace SqlDatabase.Scripts.AssemblyInternal.Net452 -{ - public partial class Net452SubDomainTest - { - public sealed class StepWithSubDomain - { - public void ShowAppBase(IDbCommand command) - { - var assembly = GetType().Assembly; - - command.CommandText = assembly.Location; - command.ExecuteNonQuery(); - - command.CommandText = AppDomain.CurrentDomain.BaseDirectory; - command.ExecuteNonQuery(); - } - - public void ShowConfiguration(IDbCommand command) - { - command.CommandText = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; - command.ExecuteNonQuery(); - - command.CommandText = MsSqlQuery.ConnectionString; - command.ExecuteNonQuery(); - } - - public void Execute(IDbCommand command) - { - var assembly = GetType().Assembly; - - var setup = new AppDomainSetup - { - ApplicationBase = Path.GetDirectoryName(assembly.Location), - ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile - }; - - var domain = AppDomain.CreateDomain("StepWithSubDomain", null, setup); - try - { - var agent = (StepDomainAgent)domain.CreateInstanceFromAndUnwrap(assembly.Location, typeof(StepDomainAgent).FullName); - - command.CommandText = agent.Hello(); - command.ExecuteNonQuery(); - } - finally - { - AppDomain.Unload(domain); - } - } - } - - public sealed class StepDomainAgent : MarshalByRefObject - { - public string Hello() - { - return "hello"; - } - } - } -} -#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/Net452/Net452SubDomainTest.cs b/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/Net452/Net452SubDomainTest.cs deleted file mode 100644 index 34d6f8fa..00000000 --- a/Sources/SqlDatabase.Test/Scripts/AssemblyInternal/Net452/Net452SubDomainTest.cs +++ /dev/null @@ -1,105 +0,0 @@ -#if NET472 -using System; -using System.Collections.Generic; -using System.Data; -using System.IO; -using Moq; -using NUnit.Framework; -using Shouldly; -using SqlDatabase.TestApi; - -namespace SqlDatabase.Scripts.AssemblyInternal.Net452 -{ - [TestFixture] - public partial class Net452SubDomainTest - { - private Net452SubDomain _sut; - private Variables _variables; - private Mock _command; - - private IList _executedScripts; - - [SetUp] - public void BeforeEachTest() - { - _variables = new Variables(); - - var log = new Mock(MockBehavior.Strict); - log - .Setup(l => l.Info(It.IsAny())) - .Callback(m => Console.WriteLine("Info: {0}", m)); - log - .Setup(l => l.Error(It.IsAny())) - .Callback(m => Console.WriteLine("Error: {0}", m)); - - _executedScripts = new List(); - _command = new Mock(MockBehavior.Strict); - _command.SetupProperty(c => c.CommandText); - _command - .Setup(c => c.ExecuteNonQuery()) - .Callback(() => _executedScripts.Add(_command.Object.CommandText)) - .Returns(0); - - _sut = new Net452SubDomain { Logger = log.Object }; - - _sut.AssemblyFileName = GetType().Assembly.Location; - _sut.ReadAssemblyContent = () => File.ReadAllBytes(GetType().Assembly.Location); - - _sut.Initialize(); - } - - [TearDown] - public void AfterEachTest() - { - _sut?.Unload(); - _sut?.Dispose(); - } - - [Test] - public void ValidateScriptDomainAppBase() - { - _sut.ResolveScriptExecutor(nameof(StepWithSubDomain), nameof(StepWithSubDomain.ShowAppBase)); - _sut.Execute(new DbCommandStub(_command.Object), _variables); - _sut.Unload(); - _sut.Dispose(); - - _executedScripts.Count.ShouldBe(2); - - var assemblyFileName = _executedScripts[0]; - FileAssert.DoesNotExist(assemblyFileName); - Path.GetFileName(GetType().Assembly.Location).ShouldBe(Path.GetFileName(assemblyFileName)); - - var appBase = _executedScripts[1]; - DirectoryAssert.DoesNotExist(appBase); - Path.GetDirectoryName(assemblyFileName).ShouldBe(appBase); - } - - [Test] - public void ValidateScriptDomainConfiguration() - { - _sut.ResolveScriptExecutor(nameof(StepWithSubDomain), nameof(StepWithSubDomain.ShowConfiguration)); - _sut.Execute(new DbCommandStub(_command.Object), _variables); - _sut.Unload(); - _sut.Dispose(); - - Assert.AreEqual(2, _executedScripts.Count); - - var configurationFile = _executedScripts[0]; - configurationFile.ShouldBe(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); - - var connectionString = _executedScripts[1]; - connectionString.ShouldBe(MsSqlQuery.ConnectionString); - } - - [Test] - public void ValidateScriptDomainCreateSubDomain() - { - _sut.ResolveScriptExecutor(nameof(StepWithSubDomain), nameof(StepWithSubDomain.Execute)); - _sut.Execute(new DbCommandStub(_command.Object), _variables); - - _executedScripts.Count.ShouldBe(1); - _executedScripts[0].ShouldBe("hello"); - } - } -} -#endif \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/DatabaseAdapterFactoryTest.cs b/Sources/SqlDatabase.Test/Scripts/DatabaseAdapterFactoryTest.cs index 22161e2c..5834b92c 100644 --- a/Sources/SqlDatabase.Test/Scripts/DatabaseAdapterFactoryTest.cs +++ b/Sources/SqlDatabase.Test/Scripts/DatabaseAdapterFactoryTest.cs @@ -1,61 +1,113 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; using SqlDatabase.Configuration; -using SqlDatabase.Scripts.MsSql; -using SqlDatabase.Scripts.MySql; -using SqlDatabase.Scripts.PgSql; -using SqlDatabase.TestApi; namespace SqlDatabase.Scripts; [TestFixture] public class DatabaseAdapterFactoryTest { - private ILogger _log; - private AppConfiguration _configuration; + private ILogger _log = null!; + private AppConfiguration _configuration = null!; [SetUp] public void BeforeEachTest() { _log = new Mock(MockBehavior.Strict).Object; - _configuration = new AppConfiguration(); + _configuration = new AppConfiguration + { + GetCurrentVersionScript = "get mssql obsolete", + SetCurrentVersionScript = "set mssql obsolete", + MsSql = + { + GetCurrentVersionScript = "get mssql", + SetCurrentVersionScript = "set mssql" + }, + MySql = + { + GetCurrentVersionScript = "get mysql", + SetCurrentVersionScript = "set mysql" + }, + PgSql = + { + GetCurrentVersionScript = "get pgsql", + SetCurrentVersionScript = "set pgsql" + } + }; } [Test] [TestCaseSource(nameof(GetCreateAdapterCases))] - public void CreateAdapter(string connectionString, string databaseName, Type expected) + public void CreateAdapter( + string connectionString, + string databaseName, + string adapterName, + string versionSelectScript, + string versionUpdateScript) { var actual = DatabaseAdapterFactory.CreateAdapter(connectionString, _configuration, _log); - actual.ShouldBeOfType(expected); + actual.GetType().Name.ShouldBe(adapterName); actual.DatabaseName.ShouldBe(databaseName); + actual.GetVersionSelectScript().ShouldBe(versionSelectScript); + actual.GetVersionUpdateScript().ShouldBe(versionUpdateScript); + } + + [Test] + public void CompatibleConnectionStrings() + { + Should.Throw(() => DatabaseAdapterFactory.CreateAdapter("Server=localhost;Host=localhost;Database=sqldatabasetest", _configuration, _log)); + } + + [Test] + public void UnknownConnectionStrings() + { + Should.Throw(() => DatabaseAdapterFactory.CreateAdapter("Server=localhost", _configuration, _log)); + } + + [Test] + public void MsSqlObsoleteConfiguration() + { + _configuration.MsSql.GetCurrentVersionScript = string.Empty; + _configuration.MsSql.SetCurrentVersionScript = string.Empty; + + var actual = DatabaseAdapterFactory.CreateAdapter("Data Source=.;Initial Catalog=SqlDatabaseTest", _configuration, _log); + actual.GetType().Name.ShouldBe("MsSqlDatabaseAdapter"); + actual.GetVersionSelectScript().ShouldBe("get mssql obsolete"); + actual.GetVersionUpdateScript().ShouldBe("set mssql obsolete"); } private static IEnumerable GetCreateAdapterCases() { yield return new TestCaseData( - MsSqlQuery.ConnectionString, - MsSqlQuery.DatabaseName, - typeof(MsSqlDatabaseAdapter)) + "Data Source=.;Initial Catalog=SqlDatabaseTest", + "SqlDatabaseTest", + "MsSqlDatabaseAdapter", + "get mssql", + "set mssql") { TestName = "MsSql" }; yield return new TestCaseData( - PgSqlQuery.ConnectionString, - PgSqlQuery.DatabaseName, - typeof(PgSqlDatabaseAdapter)) + "Host=localhost;Database=sqldatabasetest;", + "sqldatabasetest", + "PgSqlDatabaseAdapter", + "get pgsql", + "set pgsql") { TestName = "PgSql" }; yield return new TestCaseData( - MySqlQuery.ConnectionString, - MySqlQuery.DatabaseName, - typeof(MySqlDatabaseAdapter)) + "Server=localhost;Database=sqldatabasetest", + "sqldatabasetest", + "MySqlDatabaseAdapter", + "get mysql", + "set mysql") { TestName = "MySql" }; diff --git a/Sources/SqlDatabase.Test/Scripts/DatabaseTest.cs b/Sources/SqlDatabase.Test/Scripts/DatabaseTest.cs index a4472766..a0712b80 100644 --- a/Sources/SqlDatabase.Test/Scripts/DatabaseTest.cs +++ b/Sources/SqlDatabase.Test/Scripts/DatabaseTest.cs @@ -6,19 +6,21 @@ using Moq; using NUnit.Framework; using Shouldly; +using SqlDatabase.Adapter; using SqlDatabase.Configuration; +using SqlDatabase.TestApi; namespace SqlDatabase.Scripts; [TestFixture] public class DatabaseTest { - private Database _sut; - private Mock _adapter; - private Mock _command; - private Mock _connection; - private Mock _transaction; - private IList _logOutput; + private Database _sut = null!; + private Mock _adapter = null!; + private Mock _command = null!; + private Mock _connection = null!; + private Mock _transaction = null!; + private IList _logOutput = null!; [SetUp] public void BeforeEachTest() @@ -29,14 +31,14 @@ public void BeforeEachTest() .Setup(l => l.Error(It.IsAny())) .Callback(m => { - Console.WriteLine("Error: {0}", m); + TestOutput.WriteLine("Error: {0}", m); _logOutput.Add(m); }); log .Setup(l => l.Info(It.IsAny())) .Callback(m => { - Console.WriteLine("Info: {0}", m); + TestOutput.WriteLine("Info: {0}", m); _logOutput.Add(m); }); @@ -63,11 +65,7 @@ public void BeforeEachTest() _adapter = new Mock(MockBehavior.Strict); - _sut = new Database - { - Adapter = _adapter.Object, - Log = log.Object - }; + _sut = new Database(_adapter.Object, log.Object, TransactionMode.None, false); } [Test] @@ -150,7 +148,7 @@ public void GetCurrentVersionInvalidScript() var actual = Assert.Throws(() => _sut.GetCurrentVersion(null)); - actual.InnerException.ShouldBe(ex.Object); + actual!.InnerException.ShouldBe(ex.Object); actual.Message.ShouldContain("select 1"); } @@ -172,7 +170,7 @@ public void GetCurrentVersionInvalidVersion() var actual = Assert.Throws(() => _sut.GetCurrentVersion(null)); - actual.Message.ShouldContain("abc"); + actual!.Message.ShouldContain("abc"); } [Test] @@ -193,7 +191,7 @@ public void GetCurrentVersionModuleNameInvalidVersion() var actual = Assert.Throws(() => _sut.GetCurrentVersion("my module-name")); - actual.Message.ShouldContain("abc"); + actual!.Message.ShouldContain("abc"); actual.Message.ShouldContain("my module-name"); } diff --git a/Sources/SqlDatabase.Test/Scripts/ScriptFactoryTest.cs b/Sources/SqlDatabase.Test/Scripts/ScriptFactoryTest.cs deleted file mode 100644 index fd736588..00000000 --- a/Sources/SqlDatabase.Test/Scripts/ScriptFactoryTest.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.IO; -using Moq; -using NUnit.Framework; -using Shouldly; -using SqlDatabase.Configuration; -using SqlDatabase.TestApi; - -namespace SqlDatabase.Scripts; - -[TestFixture] -public class ScriptFactoryTest -{ - private ScriptFactory _sut; - private Mock _powerShellFactory; - private AssemblyScriptConfiguration _configuration; - private Mock _textReader; - - [SetUp] - public void BeforeEachTest() - { - _configuration = new AssemblyScriptConfiguration(); - _powerShellFactory = new Mock(MockBehavior.Strict); - _textReader = new Mock(MockBehavior.Strict); - - _sut = new ScriptFactory - { - AssemblyScriptConfiguration = _configuration, - PowerShellFactory = _powerShellFactory.Object, - TextReader = _textReader.Object - }; - } - - [Test] - public void FromSqlFile() - { - var file = FileFactory.File("11.sql", "some script"); - - _sut.IsSupported(file.Name).ShouldBeTrue(); - - var script = _sut.FromFile(file).ShouldBeOfType(); - - script.DisplayName.ShouldBe("11.sql"); - script.TextReader.ShouldBe(_textReader.Object); - new StreamReader(script.ReadSqlContent()).ReadToEnd().ShouldBe("some script"); - } - - [Test] - public void FromDllFile() - { - var file = FileFactory.File( - "11.dll", - new byte[] { 1, 2, 3 }, - FileFactory.Folder("name", FileFactory.File("11.txt", "3, 2, 1"))); - - _sut.IsSupported(file.Name).ShouldBeTrue(); - - var script = _sut.FromFile(file).ShouldBeOfType(); - - script.DisplayName.ShouldBe("11.dll"); - script.Configuration.ShouldBe(_configuration); - script.ReadAssemblyContent().ShouldBe(new byte[] { 1, 2, 3 }); - new StreamReader(script.ReadDescriptionContent()).ReadToEnd().ShouldBe("3, 2, 1"); - } - - [Test] - public void FromExeFile() - { - var file = FileFactory.File( - "11.exe", - new byte[] { 1, 2, 3 }, - FileFactory.Folder("name")); - - _sut.IsSupported(file.Name).ShouldBeTrue(); - - var script = _sut.FromFile(file).ShouldBeOfType(); - - script.DisplayName.ShouldBe("11.exe"); - script.Configuration.ShouldBe(_configuration); - script.ReadAssemblyContent().ShouldBe(new byte[] { 1, 2, 3 }); - script.ReadDescriptionContent().ShouldBeNull(); - } - - [Test] - public void FromPs1File() - { - var file = FileFactory.File( - "11.ps1", - "some script", - FileFactory.Folder("name", FileFactory.File("11.txt", "3, 2, 1"))); - - _powerShellFactory - .Setup(f => f.Request()); - - _sut.IsSupported(file.Name).ShouldBeTrue(); - - var script = _sut.FromFile(file).ShouldBeOfType(); - - script.PowerShellFactory.ShouldBe(_powerShellFactory.Object); - script.DisplayName.ShouldBe("11.ps1"); - new StreamReader(script.ReadScriptContent()).ReadToEnd().ShouldBe("some script"); - new StreamReader(script.ReadDescriptionContent()).ReadToEnd().ShouldBe("3, 2, 1"); - _powerShellFactory.VerifyAll(); - } - - [Test] - public void FromPs1FileNotSupported() - { - var file = FileFactory.File("11.ps1", "some script"); - _sut.PowerShellFactory = null; - - _sut.IsSupported(file.Name).ShouldBeFalse(); - - Assert.Throws(() => _sut.FromFile(file)); - } - - [Test] - public void FromFileNotSupported() - { - var file = FileFactory.File("11.txt"); - - _sut.IsSupported(file.Name).ShouldBeFalse(); - Assert.Throws(() => _sut.FromFile(file)); - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/ScriptResolverTest.cs b/Sources/SqlDatabase.Test/Scripts/ScriptResolverTest.cs new file mode 100644 index 00000000..b343c2e9 --- /dev/null +++ b/Sources/SqlDatabase.Test/Scripts/ScriptResolverTest.cs @@ -0,0 +1,76 @@ +using System; +using Moq; +using NUnit.Framework; +using Shouldly; +using SqlDatabase.Adapter; +using SqlDatabase.TestApi; + +namespace SqlDatabase.Scripts; + +[TestFixture] +public class ScriptResolverTest +{ + private ScriptResolver _sut = null!; + private Mock _factory = null!; + + [SetUp] + public void BeforeEachTest() + { + _factory = new Mock(MockBehavior.Strict); + _sut = new ScriptResolver(new[] { _factory.Object }); + } + + ////[Test] + ////public void FromSqlFile() + ////{ + //// _textReader = new Mock(MockBehavior.Strict); + + //// var file = FileFactory.File("11.sql", "some script"); + + //// _sut.IsSupported(file).ShouldBeTrue(); + + //// var script = _sut.FromFile(file).ShouldBeOfType(); + + //// script.DisplayName.ShouldBe("11.sql"); + //// script.TextReader.ShouldBe(_textReader.Object); + //// new StreamReader(script.ReadSqlContent()).ReadToEnd().ShouldBe("some script"); + ////} + + [Test] + public void FromFile() + { + var file = FileFactory.File( + "11.ps1", + "some script", + FileFactory.Folder("name", FileFactory.File("11.txt", "3, 2, 1"))); + + _factory + .Setup(f => f.IsSupported(file)) + .Returns(true); + + _sut.IsSupported(file).ShouldBeTrue(); + + var script = new Mock(MockBehavior.Strict); + + _factory + .Setup(f => f.FromFile(file)) + .Returns(script.Object); + + _sut.FromFile(file).ShouldBe(script.Object); + + _factory.VerifyAll(); + } + + [Test] + public void FromFileNotSupported() + { + var file = FileFactory.File("11.txt"); + + _factory + .Setup(f => f.IsSupported(file)) + .Returns(false); + + _sut.IsSupported(file).ShouldBeFalse(); + Assert.Throws(() => _sut.FromFile(file)); + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/Scripts/VariablesTest.cs b/Sources/SqlDatabase.Test/Scripts/VariablesTest.cs index fc0950da..4d4cfb53 100644 --- a/Sources/SqlDatabase.Test/Scripts/VariablesTest.cs +++ b/Sources/SqlDatabase.Test/Scripts/VariablesTest.cs @@ -6,7 +6,7 @@ namespace SqlDatabase.Scripts; [TestFixture] public class VariablesTest { - private Variables _sut; + private Variables _sut = null!; [SetUp] public void BeforeEachTest() diff --git a/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj b/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj index 0f3745f3..ae5cb1e9 100644 --- a/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj +++ b/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj @@ -1,59 +1,19 @@  - net472;netcoreapp3.1;net5.0;net6.0;net7.0 + net472;net6.0;net7.0;net8.0 SqlDatabase - NU1702 - ..\..\bin\Tests - - - - - - - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj.user b/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj.user index 8e59251a..88a55094 100644 --- a/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj.user +++ b/Sources/SqlDatabase.Test/SqlDatabase.Test.csproj.user @@ -1,9 +1,4 @@  - - - Component - - \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/TestApi/MsSqlQuery.cs b/Sources/SqlDatabase.Test/TestApi/MsSqlQuery.cs deleted file mode 100644 index 9578653d..00000000 --- a/Sources/SqlDatabase.Test/TestApi/MsSqlQuery.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Configuration; -using System.Data.SqlClient; - -namespace SqlDatabase.TestApi; - -internal static class MsSqlQuery -{ - public static string ConnectionString => ConfigurationManager.ConnectionStrings["mssql"].ConnectionString; - - public static string DatabaseName => new SqlConnectionStringBuilder(ConnectionString).InitialCatalog; - - public static SqlConnection Open() - { - var con = new SqlConnection(ConnectionString); - con.Open(); - - return con; - } - - public static object ExecuteScalar(string sql) - { - using (var connection = Open()) - using (var cmd = connection.CreateCommand()) - { - cmd.CommandText = sql; - return cmd.ExecuteScalar(); - } - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/TestApi/MySqlQuery.cs b/Sources/SqlDatabase.Test/TestApi/MySqlQuery.cs deleted file mode 100644 index 85fc1f75..00000000 --- a/Sources/SqlDatabase.Test/TestApi/MySqlQuery.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Configuration; -using MySqlConnector; - -namespace SqlDatabase.TestApi; - -internal static class MySqlQuery -{ - public static string ConnectionString => ConfigurationManager.ConnectionStrings["mysql"].ConnectionString; - - public static string DatabaseName => new MySqlConnectionStringBuilder(ConnectionString).Database; - - public static MySqlConnection Open() - { - var con = new MySqlConnection(ConnectionString); - con.Open(); - - return con; - } - - public static object ExecuteScalar(string sql) - { - using (var connection = Open()) - using (var cmd = connection.CreateCommand()) - { - cmd.CommandText = sql; - return cmd.ExecuteScalar(); - } - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/TestApi/PgSqlQuery.cs b/Sources/SqlDatabase.Test/TestApi/PgSqlQuery.cs deleted file mode 100644 index 9faaebf2..00000000 --- a/Sources/SqlDatabase.Test/TestApi/PgSqlQuery.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Configuration; -using Npgsql; - -namespace SqlDatabase.TestApi; - -internal static class PgSqlQuery -{ - public static string ConnectionString => ConfigurationManager.ConnectionStrings["pgsql"].ConnectionString; - - public static string DatabaseName => new NpgsqlConnectionStringBuilder(ConnectionString).Database; - - public static NpgsqlConnection Open() - { - var con = new NpgsqlConnection(ConnectionString); - con.Open(); - - return con; - } - - public static object ExecuteScalar(string sql) - { - using (var connection = Open()) - using (var cmd = connection.CreateCommand()) - { - cmd.CommandText = sql; - return cmd.ExecuteScalar(); - } - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/TestApi/TestPowerShellHost.cs b/Sources/SqlDatabase.Test/TestApi/TestPowerShellHost.cs deleted file mode 100644 index a757c04f..00000000 --- a/Sources/SqlDatabase.Test/TestApi/TestPowerShellHost.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using Moq; -using SqlDatabase.Scripts; -using SqlDatabase.Scripts.PowerShellInternal; - -namespace SqlDatabase.TestApi; - -internal static class TestPowerShellHost -{ - public static IPowerShellFactory GetOrCreateFactory() - { - if (PowerShellFactory.SharedTestFactory == null) - { - PowerShellFactory.SharedTestFactory = CreateFactory(); - } - - return PowerShellFactory.SharedTestFactory; - } - - private static IPowerShellFactory CreateFactory() - { - var logger = new Mock(MockBehavior.Strict); - logger - .Setup(l => l.Info(It.IsNotNull())) - .Callback(m => Console.WriteLine("info: " + m)); - logger - .Setup(l => l.Error(It.IsNotNull())) - .Callback(m => Console.WriteLine("error: " + m)); - logger - .Setup(l => l.Indent()) - .Returns((IDisposable)null); - - var factory = PowerShellFactory.Create(null); - factory.Request(); - factory.InitializeIfRequested(logger.Object); - return factory; - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/app.config b/Sources/SqlDatabase.Test/app.config deleted file mode 100644 index 18394b17..00000000 --- a/Sources/SqlDatabase.Test/app.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/readme.md b/Sources/SqlDatabase.Test/readme.md deleted file mode 100644 index f99d32d0..00000000 --- a/Sources/SqlDatabase.Test/readme.md +++ /dev/null @@ -1,13 +0,0 @@ -Some tests require SqlServer with already existing database. - -You can use docker: -```bash -$ cd .\SqlDatabase\Sources\SqlDatabase.Test\Docker -$ docker-compose up -``` -If database is not created during container start-up, please increase sleep timeout in entrypoint.sh. - - -Or create database manually on your SqlServer: -1. Docker\CreateDatabase.sql -2. Check connection string in app.config diff --git a/Sources/SqlDatabase.TestApi/ConfigurationExtensions.cs b/Sources/SqlDatabase.TestApi/ConfigurationExtensions.cs new file mode 100644 index 00000000..5a8843f9 --- /dev/null +++ b/Sources/SqlDatabase.TestApi/ConfigurationExtensions.cs @@ -0,0 +1,28 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Xml; +using Shouldly; + +namespace SqlDatabase.TestApi; + +public static class ConfigurationExtensions +{ + public static string GetConnectionString(string name, Type? anchor = null) + { + if (anchor == null) + { + anchor = new StackTrace().GetFrame(1)!.GetMethod()!.DeclaringType; + } + + var fileName = Path.Combine(AppContext.BaseDirectory, anchor.Assembly.GetName().Name + ".dll.config"); + + var config = new XmlDocument(); + config.Load(fileName); + + var node = config.SelectSingleNode($"configuration/connectionStrings/add[@name = '{name}']")?.Attributes?["connectionString"]; + node.ShouldNotBeNull(); + + return node.Value; + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/TestApi/FileFactory.cs b/Sources/SqlDatabase.TestApi/FileFactory.cs similarity index 72% rename from Sources/SqlDatabase.Test/TestApi/FileFactory.cs rename to Sources/SqlDatabase.TestApi/FileFactory.cs index d21981f1..69b58c61 100644 --- a/Sources/SqlDatabase.Test/TestApi/FileFactory.cs +++ b/Sources/SqlDatabase.TestApi/FileFactory.cs @@ -1,19 +1,21 @@ -using System.IO; +using System; +using System.IO; using System.Linq; using System.Text; using Moq; -using NUnit.Framework; -using SqlDatabase.IO; +using Shouldly; +using SqlDatabase.FileSystem; namespace SqlDatabase.TestApi; -internal static class FileFactory +public static class FileFactory { - public static IFile File(string name, byte[] content, IFolder parent) + public static IFile File(string name, byte[]? content, IFolder? parent) { var file = new Mock(MockBehavior.Strict); file.SetupGet(f => f.Name).Returns(name); + file.SetupGet(f => f.Extension).Returns(Path.GetExtension(name)); if (content != null) { @@ -25,15 +27,15 @@ public static IFile File(string name, byte[] content, IFolder parent) return file.Object; } - public static IFile File(string name, byte[] content = null) => File(name, content, null); + public static IFile File(string name, byte[]? content = null) => File(name, content, null); public static IFile File(string name, string content) => File(name, content, null); - public static IFile File(string name, string content, IFolder parent) + public static IFile File(string name, string content, IFolder? parent) { return File( name, - string.IsNullOrEmpty(content) ? new byte[0] : Encoding.UTF8.GetBytes(content), + string.IsNullOrEmpty(content) ? Array.Empty() : Encoding.UTF8.GetBytes(content), parent); } @@ -54,7 +56,7 @@ public static IFolder Folder(string name, params IFileSystemInfo[] content) public static string ReadAllText(this IFile file) { - Assert.IsNotNull(file); + file.ShouldNotBeNull(); using (var stream = file.OpenRead()) using (var reader = new StreamReader(stream)) diff --git a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/ResourceReader.cs b/Sources/SqlDatabase.TestApi/ResourceReader.cs similarity index 53% rename from Sources/SqlDatabase.Test/Scripts/SqlTestCases/ResourceReader.cs rename to Sources/SqlDatabase.TestApi/ResourceReader.cs index 2ddcebee..5e751431 100644 --- a/Sources/SqlDatabase.Test/Scripts/SqlTestCases/ResourceReader.cs +++ b/Sources/SqlDatabase.TestApi/ResourceReader.cs @@ -1,33 +1,47 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using System.Text; +using Shouldly; -namespace SqlDatabase.Scripts.SqlTestCases; +namespace SqlDatabase.TestApi; -internal static class ResourceReader +public static class ResourceReader { - public static IEnumerable<(string Name, string Input, string[] Expected)> Read(string folder) + public static Stream GetManifestResourceStream(string resourceName, Type? resourceAnchor = null) { - var anchor = typeof(ResourceReader); - var prefix = anchor.Namespace + "." + anchor.Name + "." + folder + "."; + if (resourceAnchor == null) + { + resourceAnchor = new StackTrace().GetFrame(1)!.GetMethod()!.DeclaringType; + } + + var result = resourceAnchor!.Assembly.GetManifestResourceStream(resourceAnchor.Namespace + "." + resourceName); + result.ShouldNotBeNull(resourceName); + + return result; + } - var sources = anchor - .Assembly + public static IEnumerable<(string Name, string Input, string[] Expected)> Read(Assembly assembly, string filter) + { + var sources = assembly .GetManifestResourceNames() - .Where(i => i.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) - .OrderBy(i => i); + .Where(i => i.IndexOf(filter, StringComparison.Ordinal) >= 0) + .OrderBy(i => i) + .ToArray(); + + sources.ShouldNotBeEmpty(); foreach (var sourceName in sources) { - using (var stream = anchor.Assembly.GetManifestResourceStream(sourceName)) - using (var reader = new StreamReader(stream)) + using (var stream = assembly.GetManifestResourceStream(sourceName)) + using (var reader = new StreamReader(stream!)) { - var name = Path.GetFileNameWithoutExtension(sourceName.Substring(prefix.Length)); var (input, expected) = ParseResource(reader); - yield return (name, input, expected); + yield return (GetShortName(sourceName), input, expected); } } } @@ -42,7 +56,7 @@ private static (string Input, string[] Expected) ParseResource(TextReader reader var isInput = true; - string line; + string? line; while ((line = reader.ReadLine()) != null) { if (line == Separator) @@ -81,4 +95,22 @@ private static (string Input, string[] Expected) ParseResource(TextReader reader return (input.ToString(), expected.ToArray()); } + + private static string GetShortName(string fullName) + { + var result = fullName; + + var index = fullName.LastIndexOf('.'); + if (index > 0) + { + index = fullName.LastIndexOf('.', index - 1); + } + + if (index > 0) + { + result = fullName.Substring(index + 1); + } + + return result; + } } \ No newline at end of file diff --git a/Sources/SqlDatabase.TestApi/SqlDatabase.TestApi.csproj b/Sources/SqlDatabase.TestApi/SqlDatabase.TestApi.csproj new file mode 100644 index 00000000..3793781f --- /dev/null +++ b/Sources/SqlDatabase.TestApi/SqlDatabase.TestApi.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/Sources/SqlDatabase.Test/TestApi/TempConsoleOut.cs b/Sources/SqlDatabase.TestApi/TempConsoleOut.cs similarity index 92% rename from Sources/SqlDatabase.Test/TestApi/TempConsoleOut.cs rename to Sources/SqlDatabase.TestApi/TempConsoleOut.cs index 7d9be97e..942c8cb7 100644 --- a/Sources/SqlDatabase.Test/TestApi/TempConsoleOut.cs +++ b/Sources/SqlDatabase.TestApi/TempConsoleOut.cs @@ -3,7 +3,7 @@ namespace SqlDatabase.TestApi; -internal sealed class TempConsoleOut : IDisposable +public sealed class TempConsoleOut : IDisposable { private readonly TextWriter _originalOutput; private readonly Buffer _buffer; diff --git a/Sources/SqlDatabase.Test/TestApi/TempDirectory.cs b/Sources/SqlDatabase.TestApi/TempDirectory.cs similarity index 64% rename from Sources/SqlDatabase.Test/TestApi/TempDirectory.cs rename to Sources/SqlDatabase.TestApi/TempDirectory.cs index f42cec74..9f646124 100644 --- a/Sources/SqlDatabase.Test/TestApi/TempDirectory.cs +++ b/Sources/SqlDatabase.TestApi/TempDirectory.cs @@ -1,13 +1,13 @@ using System; using System.Diagnostics; using System.IO; -using NUnit.Framework; +using Shouldly; namespace SqlDatabase.TestApi; -internal sealed class TempDirectory : IDisposable +public sealed class TempDirectory : IDisposable { - public TempDirectory(string name = null) + public TempDirectory(string? name = null) { Location = Path.Combine(Path.GetTempPath(), name ?? Guid.NewGuid().ToString()); Directory.CreateDirectory(Location); @@ -15,22 +15,22 @@ public TempDirectory(string name = null) public string Location { get; } - public string CopyFileFromResources(string resourceName, Type resourceAnchor = null) + public string CopyFileFromResources(string resourceName, Type? resourceAnchor = null) { if (resourceAnchor == null) { - resourceAnchor = new StackTrace().GetFrame(1).GetMethod().DeclaringType; + resourceAnchor = new StackTrace().GetFrame(1)!.GetMethod()!.DeclaringType; } - var source = resourceAnchor.Assembly.GetManifestResourceStream(resourceAnchor.Namespace + "." + resourceName); - Assert.IsNotNull(source, resourceName); + var source = resourceAnchor!.Assembly.GetManifestResourceStream(resourceAnchor.Namespace + "." + resourceName); + source.ShouldNotBeNull(resourceName); var fileName = Path.Combine(Location, resourceName); using (source) using (var dest = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite)) { - source.CopyTo(dest); + source!.CopyTo(dest); } return fileName; diff --git a/Sources/SqlDatabase.Test/TestApi/TempFile.cs b/Sources/SqlDatabase.TestApi/TempFile.cs similarity index 89% rename from Sources/SqlDatabase.Test/TestApi/TempFile.cs rename to Sources/SqlDatabase.TestApi/TempFile.cs index 91777ed8..d327c9bf 100644 --- a/Sources/SqlDatabase.Test/TestApi/TempFile.cs +++ b/Sources/SqlDatabase.TestApi/TempFile.cs @@ -3,7 +3,7 @@ namespace SqlDatabase.TestApi; -internal sealed class TempFile : IDisposable +public sealed class TempFile : IDisposable { public TempFile(string extension) { diff --git a/Sources/SqlDatabase.TestApi/TestOutput.cs b/Sources/SqlDatabase.TestApi/TestOutput.cs new file mode 100644 index 00000000..21d173a8 --- /dev/null +++ b/Sources/SqlDatabase.TestApi/TestOutput.cs @@ -0,0 +1,19 @@ +using System; +using System.Diagnostics; + +namespace SqlDatabase.TestApi; + +public static class TestOutput +{ + [Conditional("DEBUG")] + public static void WriteLine() => Console.WriteLine(); + + [Conditional("DEBUG")] + public static void WriteLine(string? value) => Console.WriteLine(value); + + [Conditional("DEBUG")] + public static void WriteLine(object? value) => Console.WriteLine(value); + + [Conditional("DEBUG")] + public static void WriteLine(string format, object? arg0) => Console.WriteLine(format, arg0); +} \ No newline at end of file diff --git a/Sources/SqlDatabase.Test/TestApi/TextExtensions.cs b/Sources/SqlDatabase.TestApi/TextExtensions.cs similarity index 86% rename from Sources/SqlDatabase.Test/TestApi/TextExtensions.cs rename to Sources/SqlDatabase.TestApi/TextExtensions.cs index 6353f3ca..a70c8949 100644 --- a/Sources/SqlDatabase.Test/TestApi/TextExtensions.cs +++ b/Sources/SqlDatabase.TestApi/TextExtensions.cs @@ -4,7 +4,7 @@ namespace SqlDatabase.TestApi; -internal static class TextExtensions +public static class TextExtensions { public static Func AsFuncStream(this string text) { diff --git a/Sources/SqlDatabase.sln b/Sources/SqlDatabase.sln index 6b1e883c..c0bc870f 100644 --- a/Sources/SqlDatabase.sln +++ b/Sources/SqlDatabase.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2036 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34227.203 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{41240983-0CDD-4312-AB28-7FA8DE338126}" ProjectSection(SolutionItems) = preProject @@ -20,7 +20,49 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.PowerShell", "S EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.PowerShell.Test", "SqlDatabase.PowerShell.Test\SqlDatabase.PowerShell.Test.csproj", "{4F35E6D2-99FB-4B7B-90A5-3BFA936FB8CF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlDatabase.Package", "SqlDatabase.Package\SqlDatabase.Package.csproj", "{F986789D-F9B3-42B4-AA4B-4C0A63011F5D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Package", "SqlDatabase.Package\SqlDatabase.Package.csproj", "{F986789D-F9B3-42B4-AA4B-4C0A63011F5D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.FileSystem", "SqlDatabase.FileSystem\SqlDatabase.FileSystem.csproj", "{8BFF1266-C87C-4072-B16F-7A715D0A22B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.FileSystem.Test", "SqlDatabase.FileSystem.Test\SqlDatabase.FileSystem.Test.csproj", "{4334C327-A578-4247-B1CC-23A63B2CC7F2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.TestApi", "SqlDatabase.TestApi\SqlDatabase.TestApi.csproj", "{8724A867-C5F5-4A7C-B414-D84AB9830AA0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter", "SqlDatabase.Adapter\SqlDatabase.Adapter.csproj", "{CDC9677C-6205-402B-ADE2-C958B8A7DD24}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.AssemblyScripts", "SqlDatabase.Adapter.AssemblyScripts\SqlDatabase.Adapter.AssemblyScripts.csproj", "{A5D5FEF3-6675-4E1A-9A7F-C3B3CDB3ACB5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.AssemblyScripts.Test", "SqlDatabase.Adapter.AssemblyScripts.Test\SqlDatabase.Adapter.AssemblyScripts.Test.csproj", "{68DC9F11-567F-4A51-85E6-4C87994F9FFF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.PowerShellScripts", "SqlDatabase.Adapter.PowerShellScripts\SqlDatabase.Adapter.PowerShellScripts.csproj", "{F8FEE835-4DFB-4143-BC93-EB7C50C951CB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.PowerShellScripts.Test", "SqlDatabase.Adapter.PowerShellScripts.Test\SqlDatabase.Adapter.PowerShellScripts.Test.csproj", "{4539721A-947F-4AD1-B007-EE695761B8F9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Sequence", "SqlDatabase.Sequence\SqlDatabase.Sequence.csproj", "{AB3E3C7B-1475-4967-84DA-970D663D6FA3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Sequence.Test", "SqlDatabase.Sequence.Test\SqlDatabase.Sequence.Test.csproj", "{1C4B4036-9C17-49AD-B087-A4D044296D1A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.MsSql", "SqlDatabase.Adapter.MsSql\SqlDatabase.Adapter.MsSql.csproj", "{D45B3C71-75DF-4613-B0CD-356C7998BE27}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.MsSql.Test", "SqlDatabase.Adapter.MsSql.Test\SqlDatabase.Adapter.MsSql.Test.csproj", "{93FBF3ED-A6F3-4EBF-8779-A398D6654C03}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.Sql", "SqlDatabase.Adapter.Sql\SqlDatabase.Adapter.Sql.csproj", "{267D99B6-4882-4ECE-8EEC-A15216D97692}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.Sql.Test", "SqlDatabase.Adapter.Sql.Test\SqlDatabase.Adapter.Sql.Test.csproj", "{74003456-8C80-402A-AD68-24B02350ADDC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.PgSql", "SqlDatabase.Adapter.PgSql\SqlDatabase.Adapter.PgSql.csproj", "{B6CB9CE4-ECA7-40AC-8926-AE2CBCCDB172}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.PgSql.Test", "SqlDatabase.Adapter.PgSql.Test\SqlDatabase.Adapter.PgSql.Test.csproj", "{33749EF7-49CE-4564-BF9D-5713806CC646}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.MySql", "SqlDatabase.Adapter.MySql\SqlDatabase.Adapter.MySql.csproj", "{49B103C8-958D-41B2-AB22-EDF029947AB1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDatabase.Adapter.MySql.Test", "SqlDatabase.Adapter.MySql.Test\SqlDatabase.Adapter.MySql.Test.csproj", "{D017ECF1-F2E3-4EAF-970B-F46991AD86F6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlDatabase.Configuration", "SqlDatabase.Configuration\SqlDatabase.Configuration.csproj", "{A351BD5C-F646-42BB-A1E0-EA63E88934D9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlDatabase.Configuration.Test", "SqlDatabase.Configuration.Test\SqlDatabase.Configuration.Test.csproj", "{1D6B0790-DE5A-4057-AC65-76FA2E7EF198}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -52,12 +94,104 @@ Global {F986789D-F9B3-42B4-AA4B-4C0A63011F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {F986789D-F9B3-42B4-AA4B-4C0A63011F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU {F986789D-F9B3-42B4-AA4B-4C0A63011F5D}.Release|Any CPU.Build.0 = Release|Any CPU + {8BFF1266-C87C-4072-B16F-7A715D0A22B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BFF1266-C87C-4072-B16F-7A715D0A22B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BFF1266-C87C-4072-B16F-7A715D0A22B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BFF1266-C87C-4072-B16F-7A715D0A22B8}.Release|Any CPU.Build.0 = Release|Any CPU + {4334C327-A578-4247-B1CC-23A63B2CC7F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4334C327-A578-4247-B1CC-23A63B2CC7F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4334C327-A578-4247-B1CC-23A63B2CC7F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4334C327-A578-4247-B1CC-23A63B2CC7F2}.Release|Any CPU.Build.0 = Release|Any CPU + {8724A867-C5F5-4A7C-B414-D84AB9830AA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8724A867-C5F5-4A7C-B414-D84AB9830AA0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8724A867-C5F5-4A7C-B414-D84AB9830AA0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8724A867-C5F5-4A7C-B414-D84AB9830AA0}.Release|Any CPU.Build.0 = Release|Any CPU + {CDC9677C-6205-402B-ADE2-C958B8A7DD24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CDC9677C-6205-402B-ADE2-C958B8A7DD24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CDC9677C-6205-402B-ADE2-C958B8A7DD24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CDC9677C-6205-402B-ADE2-C958B8A7DD24}.Release|Any CPU.Build.0 = Release|Any CPU + {A5D5FEF3-6675-4E1A-9A7F-C3B3CDB3ACB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5D5FEF3-6675-4E1A-9A7F-C3B3CDB3ACB5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5D5FEF3-6675-4E1A-9A7F-C3B3CDB3ACB5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5D5FEF3-6675-4E1A-9A7F-C3B3CDB3ACB5}.Release|Any CPU.Build.0 = Release|Any CPU + {68DC9F11-567F-4A51-85E6-4C87994F9FFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68DC9F11-567F-4A51-85E6-4C87994F9FFF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68DC9F11-567F-4A51-85E6-4C87994F9FFF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68DC9F11-567F-4A51-85E6-4C87994F9FFF}.Release|Any CPU.Build.0 = Release|Any CPU + {F8FEE835-4DFB-4143-BC93-EB7C50C951CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8FEE835-4DFB-4143-BC93-EB7C50C951CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8FEE835-4DFB-4143-BC93-EB7C50C951CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8FEE835-4DFB-4143-BC93-EB7C50C951CB}.Release|Any CPU.Build.0 = Release|Any CPU + {4539721A-947F-4AD1-B007-EE695761B8F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4539721A-947F-4AD1-B007-EE695761B8F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4539721A-947F-4AD1-B007-EE695761B8F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4539721A-947F-4AD1-B007-EE695761B8F9}.Release|Any CPU.Build.0 = Release|Any CPU + {AB3E3C7B-1475-4967-84DA-970D663D6FA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AB3E3C7B-1475-4967-84DA-970D663D6FA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AB3E3C7B-1475-4967-84DA-970D663D6FA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AB3E3C7B-1475-4967-84DA-970D663D6FA3}.Release|Any CPU.Build.0 = Release|Any CPU + {1C4B4036-9C17-49AD-B087-A4D044296D1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C4B4036-9C17-49AD-B087-A4D044296D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C4B4036-9C17-49AD-B087-A4D044296D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C4B4036-9C17-49AD-B087-A4D044296D1A}.Release|Any CPU.Build.0 = Release|Any CPU + {D45B3C71-75DF-4613-B0CD-356C7998BE27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D45B3C71-75DF-4613-B0CD-356C7998BE27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D45B3C71-75DF-4613-B0CD-356C7998BE27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D45B3C71-75DF-4613-B0CD-356C7998BE27}.Release|Any CPU.Build.0 = Release|Any CPU + {93FBF3ED-A6F3-4EBF-8779-A398D6654C03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {93FBF3ED-A6F3-4EBF-8779-A398D6654C03}.Debug|Any CPU.Build.0 = Debug|Any CPU + {93FBF3ED-A6F3-4EBF-8779-A398D6654C03}.Release|Any CPU.ActiveCfg = Release|Any CPU + {93FBF3ED-A6F3-4EBF-8779-A398D6654C03}.Release|Any CPU.Build.0 = Release|Any CPU + {267D99B6-4882-4ECE-8EEC-A15216D97692}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {267D99B6-4882-4ECE-8EEC-A15216D97692}.Debug|Any CPU.Build.0 = Debug|Any CPU + {267D99B6-4882-4ECE-8EEC-A15216D97692}.Release|Any CPU.ActiveCfg = Release|Any CPU + {267D99B6-4882-4ECE-8EEC-A15216D97692}.Release|Any CPU.Build.0 = Release|Any CPU + {74003456-8C80-402A-AD68-24B02350ADDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74003456-8C80-402A-AD68-24B02350ADDC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {74003456-8C80-402A-AD68-24B02350ADDC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {74003456-8C80-402A-AD68-24B02350ADDC}.Release|Any CPU.Build.0 = Release|Any CPU + {B6CB9CE4-ECA7-40AC-8926-AE2CBCCDB172}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6CB9CE4-ECA7-40AC-8926-AE2CBCCDB172}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6CB9CE4-ECA7-40AC-8926-AE2CBCCDB172}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6CB9CE4-ECA7-40AC-8926-AE2CBCCDB172}.Release|Any CPU.Build.0 = Release|Any CPU + {33749EF7-49CE-4564-BF9D-5713806CC646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33749EF7-49CE-4564-BF9D-5713806CC646}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33749EF7-49CE-4564-BF9D-5713806CC646}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33749EF7-49CE-4564-BF9D-5713806CC646}.Release|Any CPU.Build.0 = Release|Any CPU + {49B103C8-958D-41B2-AB22-EDF029947AB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {49B103C8-958D-41B2-AB22-EDF029947AB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49B103C8-958D-41B2-AB22-EDF029947AB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {49B103C8-958D-41B2-AB22-EDF029947AB1}.Release|Any CPU.Build.0 = Release|Any CPU + {D017ECF1-F2E3-4EAF-970B-F46991AD86F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D017ECF1-F2E3-4EAF-970B-F46991AD86F6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D017ECF1-F2E3-4EAF-970B-F46991AD86F6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D017ECF1-F2E3-4EAF-970B-F46991AD86F6}.Release|Any CPU.Build.0 = Release|Any CPU + {A351BD5C-F646-42BB-A1E0-EA63E88934D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A351BD5C-F646-42BB-A1E0-EA63E88934D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A351BD5C-F646-42BB-A1E0-EA63E88934D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A351BD5C-F646-42BB-A1E0-EA63E88934D9}.Release|Any CPU.Build.0 = Release|Any CPU + {1D6B0790-DE5A-4057-AC65-76FA2E7EF198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D6B0790-DE5A-4057-AC65-76FA2E7EF198}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D6B0790-DE5A-4057-AC65-76FA2E7EF198}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D6B0790-DE5A-4057-AC65-76FA2E7EF198}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {1B458B5B-D39C-4247-BFB9-A5D9B8D4D85C} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} {8FE68E2C-586F-4E22-BDA3-4E65473BC3D7} = {D68226E5-B167-48D9-985C-B13CA6538634} + {4F35E6D2-99FB-4B7B-90A5-3BFA936FB8CF} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {4334C327-A578-4247-B1CC-23A63B2CC7F2} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {8724A867-C5F5-4A7C-B414-D84AB9830AA0} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {68DC9F11-567F-4A51-85E6-4C87994F9FFF} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {4539721A-947F-4AD1-B007-EE695761B8F9} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {1C4B4036-9C17-49AD-B087-A4D044296D1A} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {93FBF3ED-A6F3-4EBF-8779-A398D6654C03} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {74003456-8C80-402A-AD68-24B02350ADDC} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {33749EF7-49CE-4564-BF9D-5713806CC646} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {D017ECF1-F2E3-4EAF-970B-F46991AD86F6} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} + {1D6B0790-DE5A-4057-AC65-76FA2E7EF198} = {6E9C8ACC-7A1B-47F4-B7C0-78DE8C931A08} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CFDC1B98-55BE-40C3-BF95-A2BA8182DC40} diff --git a/Sources/SqlDatabase/App.config b/Sources/SqlDatabase/App.config index a9a94438..fb800a56 100644 --- a/Sources/SqlDatabase/App.config +++ b/Sources/SqlDatabase/App.config @@ -51,6 +51,6 @@ + sku=".NETFramework,Version=v4.7.2" /> \ No newline at end of file diff --git a/Sources/SqlDatabase/CodeAnalysis/AllowNullAttribute.cs b/Sources/SqlDatabase/CodeAnalysis/AllowNullAttribute.cs new file mode 100644 index 00000000..39be8db8 --- /dev/null +++ b/Sources/SqlDatabase/CodeAnalysis/AllowNullAttribute.cs @@ -0,0 +1,8 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] +internal sealed class AllowNullAttribute : Attribute +{ +} +#endif \ No newline at end of file diff --git a/Sources/SqlDatabase/CodeAnalysis/NotNullWhenAttribute.cs b/Sources/SqlDatabase/CodeAnalysis/NotNullWhenAttribute.cs new file mode 100644 index 00000000..e3d56cf7 --- /dev/null +++ b/Sources/SqlDatabase/CodeAnalysis/NotNullWhenAttribute.cs @@ -0,0 +1,10 @@ +#if NET472 || NETSTANDARD2_0 +namespace System.Diagnostics.CodeAnalysis; + +internal sealed class NotNullWhenAttribute : Attribute +{ + public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; + + public bool ReturnValue { get; } +} +#endif diff --git a/Sources/SqlDatabase/Commands/DatabaseCommandBase.cs b/Sources/SqlDatabase/Commands/DatabaseCommandBase.cs index 55af56cf..299fb358 100644 --- a/Sources/SqlDatabase/Commands/DatabaseCommandBase.cs +++ b/Sources/SqlDatabase/Commands/DatabaseCommandBase.cs @@ -1,12 +1,19 @@ -using SqlDatabase.Scripts; +using SqlDatabase.Adapter; +using SqlDatabase.Scripts; namespace SqlDatabase.Commands; internal abstract class DatabaseCommandBase : ICommand { - public ILogger Log { get; set; } + protected DatabaseCommandBase(IDatabase database, ILogger log) + { + Database = database; + Log = log; + } + + public ILogger Log { get; } - public IDatabase Database { get; set; } + public IDatabase Database { get; } public void Execute() { diff --git a/Sources/SqlDatabase/Commands/DatabaseCreateCommand.cs b/Sources/SqlDatabase/Commands/DatabaseCreateCommand.cs index fe7a1f4d..cfd63119 100644 --- a/Sources/SqlDatabase/Commands/DatabaseCreateCommand.cs +++ b/Sources/SqlDatabase/Commands/DatabaseCreateCommand.cs @@ -1,18 +1,31 @@ -using System.Configuration; -using System.Diagnostics; +using System.Diagnostics; +using SqlDatabase.Adapter; +using SqlDatabase.Configuration; using SqlDatabase.Scripts; +using SqlDatabase.Sequence; namespace SqlDatabase.Commands; internal sealed class DatabaseCreateCommand : DatabaseCommandBase { - public ICreateScriptSequence ScriptSequence { get; set; } + public DatabaseCreateCommand( + ICreateScriptSequence scriptSequence, + IScriptResolver scriptResolver, + IDatabase database, + ILogger log) + : base(database, log) + { + ScriptSequence = scriptSequence; + ScriptResolver = scriptResolver; + } + + public ICreateScriptSequence ScriptSequence { get; } - public IPowerShellFactory PowerShellFactory { get; set; } + public IScriptResolver ScriptResolver { get; } protected override void Greet(string databaseLocation) { - Log.Info("Create {0}".FormatWith(databaseLocation)); + Log.Info($"Create {databaseLocation}"); } protected override void ExecuteCore() @@ -23,19 +36,19 @@ protected override void ExecuteCore() throw new ConfigurationErrorsException("scripts to create database not found."); } - PowerShellFactory.InitializeIfRequested(Log); + ScriptResolver.InitializeEnvironment(Log, sequences); foreach (var script in sequences) { var timer = Stopwatch.StartNew(); - Log.Info("execute {0} ...".FormatWith(script.DisplayName)); + Log.Info($"execute {script.DisplayName} ..."); using (Log.Indent()) { Database.Execute(script); } - Log.Info("done in {0}".FormatWith(timer.Elapsed)); + Log.Info($"done in {timer.Elapsed}"); } } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Commands/DatabaseExecuteCommand.cs b/Sources/SqlDatabase/Commands/DatabaseExecuteCommand.cs index 395c041e..fba1f2cf 100644 --- a/Sources/SqlDatabase/Commands/DatabaseExecuteCommand.cs +++ b/Sources/SqlDatabase/Commands/DatabaseExecuteCommand.cs @@ -1,36 +1,53 @@ using System.Diagnostics; +using SqlDatabase.Adapter; using SqlDatabase.Scripts; +using SqlDatabase.Sequence; namespace SqlDatabase.Commands; internal sealed class DatabaseExecuteCommand : DatabaseCommandBase { - public ICreateScriptSequence ScriptSequence { get; set; } + public DatabaseExecuteCommand( + ICreateScriptSequence scriptSequence, + IScriptResolver scriptResolver, + IDatabase database, + ILogger log) + : base(database, log) + { + ScriptSequence = scriptSequence; + ScriptResolver = scriptResolver; + } + + public ICreateScriptSequence ScriptSequence { get; } - public IPowerShellFactory PowerShellFactory { get; set; } + public IScriptResolver ScriptResolver { get; } protected override void Greet(string databaseLocation) { - Log.Info("Execute script on {0}".FormatWith(databaseLocation)); + Log.Info($"Execute script on {databaseLocation}"); } protected override void ExecuteCore() { var sequences = ScriptSequence.BuildSequence(); + if (sequences.Count == 0) + { + return; + } - PowerShellFactory.InitializeIfRequested(Log); + ScriptResolver.InitializeEnvironment(Log, sequences); foreach (var script in sequences) { var timer = Stopwatch.StartNew(); - Log.Info("execute {0} ...".FormatWith(script.DisplayName)); + Log.Info($"execute {script.DisplayName} ..."); using (Log.Indent()) { Database.Execute(script); } - Log.Info("done in {0}".FormatWith(timer.Elapsed)); + Log.Info($"done in {timer.Elapsed}"); } } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Commands/DatabaseExportCommand.cs b/Sources/SqlDatabase/Commands/DatabaseExportCommand.cs index 78cabddb..82769fc0 100644 --- a/Sources/SqlDatabase/Commands/DatabaseExportCommand.cs +++ b/Sources/SqlDatabase/Commands/DatabaseExportCommand.cs @@ -2,29 +2,52 @@ using System.Diagnostics; using System.IO; using System.Text; -using SqlDatabase.Export; +using SqlDatabase.Adapter; +using SqlDatabase.Adapter.Sql.Export; using SqlDatabase.Scripts; +using SqlDatabase.Sequence; namespace SqlDatabase.Commands; internal sealed class DatabaseExportCommand : DatabaseCommandBase { - public ICreateScriptSequence ScriptSequence { get; set; } + public DatabaseExportCommand( + ICreateScriptSequence scriptSequence, + IScriptResolver scriptResolver, + Func openOutput, + IDatabase database, + ILogger log) + : base(database, log) + { + ScriptSequence = scriptSequence; + ScriptResolver = scriptResolver; + OpenOutput = openOutput; + } + + public ICreateScriptSequence ScriptSequence { get; } + + public IScriptResolver ScriptResolver { get; } - public Func OpenOutput { get; set; } + public Func OpenOutput { get; } - public string DestinationTableName { get; set; } + public string? DestinationTableName { get; set; } internal Func ExporterFactory { get; set; } = () => new DataExporter(); protected override void Greet(string databaseLocation) { - Log.Info("Export data from {0}".FormatWith(databaseLocation)); + Log.Info($"Export data from {databaseLocation}"); } protected override void ExecuteCore() { var sequences = ScriptSequence.BuildSequence(); + if (sequences.Count == 0) + { + return; + } + + ScriptResolver.InitializeEnvironment(Log, sequences); using (var output = OpenOutput()) { @@ -42,19 +65,19 @@ protected override void ExecuteCore() foreach (var script in sequences) { var timer = Stopwatch.StartNew(); - Log.Info("export {0} ...".FormatWith(script.DisplayName)); + Log.Info($"export {script.DisplayName} ..."); using (Log.Indent()) { ExportScript(exporter, script, ref readerIndex); } - Log.Info("done in {0}".FormatWith(timer.Elapsed)); + Log.Info($"done in {timer.Elapsed}"); } } } - private static string GetExportTableName(string name, int index, int subIndex) + private static string GetExportTableName(string? name, int index, int subIndex) { var result = new StringBuilder(20); diff --git a/Sources/SqlDatabase/Commands/DatabaseUpgradeCommand.cs b/Sources/SqlDatabase/Commands/DatabaseUpgradeCommand.cs index 22e47719..fa0d8d6f 100644 --- a/Sources/SqlDatabase/Commands/DatabaseUpgradeCommand.cs +++ b/Sources/SqlDatabase/Commands/DatabaseUpgradeCommand.cs @@ -2,19 +2,32 @@ using System.Diagnostics; using System.Linq; using System.Text; +using SqlDatabase.Adapter; using SqlDatabase.Scripts; +using SqlDatabase.Sequence; namespace SqlDatabase.Commands; internal sealed class DatabaseUpgradeCommand : DatabaseCommandBase { - public IUpgradeScriptSequence ScriptSequence { get; set; } + public DatabaseUpgradeCommand( + IUpgradeScriptSequence scriptSequence, + IScriptResolver scriptResolver, + IDatabase database, + ILogger log) + : base(database, log) + { + ScriptSequence = scriptSequence; + ScriptResolver = scriptResolver; + } + + public IUpgradeScriptSequence ScriptSequence { get; } - public IPowerShellFactory PowerShellFactory { get; set; } + public IScriptResolver ScriptResolver { get; } protected override void Greet(string databaseLocation) { - Log.Info("Upgrade {0}".FormatWith(databaseLocation)); + Log.Info($"Upgrade {databaseLocation}"); } protected override void ExecuteCore() @@ -35,18 +48,18 @@ protected override void ExecuteCore() ShowMigrationSequenceFull(sequence); } - PowerShellFactory.InitializeIfRequested(Log); + ScriptResolver.InitializeEnvironment(Log, sequence.Select(i => i.Script)); foreach (var step in sequence) { var timer = Stopwatch.StartNew(); if (string.IsNullOrEmpty(step.ModuleName)) { - Log.Info("execute {0} ...".FormatWith(step.Script.DisplayName)); + Log.Info($"execute {step.Script.DisplayName} ..."); } else { - Log.Info("execute {0} {1} ...".FormatWith(step.ModuleName, step.Script.DisplayName)); + Log.Info($"execute {step.ModuleName} {step.Script.DisplayName} ..."); } using (Log.Indent()) @@ -54,7 +67,7 @@ protected override void ExecuteCore() Database.Execute(step.Script, step.ModuleName, step.From, step.To); } - Log.Info("done in {0}".FormatWith(timer.Elapsed)); + Log.Info($"done in {timer.Elapsed}"); } } diff --git a/Sources/SqlDatabase/Commands/EchoCommand.cs b/Sources/SqlDatabase/Commands/EchoCommand.cs index 475be66a..31423d4d 100644 --- a/Sources/SqlDatabase/Commands/EchoCommand.cs +++ b/Sources/SqlDatabase/Commands/EchoCommand.cs @@ -1,18 +1,28 @@ -using SqlDatabase.Configuration; +using SqlDatabase.Adapter; +using SqlDatabase.Configuration; namespace SqlDatabase.Commands; internal sealed class EchoCommand : ICommand { - public ILogger Logger { get; set; } + public EchoCommand(ILogger logger, CommandLine args) + { + Logger = logger; + Args = args; + } + + public ILogger Logger { get; } - public CommandLine Args { get; set; } + public CommandLine Args { get; } public void Execute() { - foreach (var arg in Args.Original) + if (Args.Original != null) { - Logger.Info(arg); + foreach (var arg in Args.Original) + { + Logger.Info(arg); + } } } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/AppConfiguration.cs b/Sources/SqlDatabase/Configuration/AppConfiguration.cs deleted file mode 100644 index e40b43d0..00000000 --- a/Sources/SqlDatabase/Configuration/AppConfiguration.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Configuration; - -namespace SqlDatabase.Configuration; - -public sealed class AppConfiguration : ConfigurationSection -{ - public const string SectionName = "sqlDatabase"; - - private const string PropertyGetCurrentVersionScript = "getCurrentVersion"; - private const string PropertySetCurrentVersionScript = "setCurrentVersion"; - private const string PropertyAssemblyScript = "assemblyScript"; - private const string PropertyVariables = "variables"; - private const string PropertyMsSql = "mssql"; - private const string PropertyPgSql = "pgsql"; - private const string PropertyMySql = "mysql"; - - [ConfigurationProperty(PropertyGetCurrentVersionScript)] - public string GetCurrentVersionScript - { - get => (string)this[PropertyGetCurrentVersionScript]; - set => this[PropertyGetCurrentVersionScript] = value; - } - - [ConfigurationProperty(PropertySetCurrentVersionScript)] - public string SetCurrentVersionScript - { - get => (string)this[PropertySetCurrentVersionScript]; - set => this[PropertySetCurrentVersionScript] = value; - } - - [ConfigurationProperty(PropertyAssemblyScript)] - public AssemblyScriptConfiguration AssemblyScript => (AssemblyScriptConfiguration)this[PropertyAssemblyScript]; - - [ConfigurationProperty(PropertyVariables)] - public NameValueConfigurationCollection Variables => (NameValueConfigurationCollection)this[PropertyVariables]; - - [ConfigurationProperty(PropertyMsSql)] - public DatabaseConfiguration MsSql => (DatabaseConfiguration)this[PropertyMsSql]; - - [ConfigurationProperty(PropertyPgSql)] - public DatabaseConfiguration PgSql => (DatabaseConfiguration)this[PropertyPgSql]; - - [ConfigurationProperty(PropertyMySql)] - public DatabaseConfiguration MySql => (DatabaseConfiguration)this[PropertyMySql]; -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/Arg.cs b/Sources/SqlDatabase/Configuration/Arg.cs index 4ffe1c1d..8be89428 100644 --- a/Sources/SqlDatabase/Configuration/Arg.cs +++ b/Sources/SqlDatabase/Configuration/Arg.cs @@ -22,7 +22,7 @@ internal readonly struct Arg internal const string Log = "log"; - public Arg(string key, string value) + public Arg(string key, string? value) { IsPair = true; Key = key; @@ -38,15 +38,15 @@ public Arg(string value) public bool IsPair { get; } - public string Key { get; } + public string? Key { get; } - public string Value { get; } + public string? Value { get; } - public override string ToString() + public override string? ToString() { if (IsPair) { - return "{0}={1}".FormatWith(Key, Value); + return $"{Key}={Value}"; } return Value; diff --git a/Sources/SqlDatabase/Configuration/AssemblyScriptConfiguration.cs b/Sources/SqlDatabase/Configuration/AssemblyScriptConfiguration.cs deleted file mode 100644 index 68d1c63d..00000000 --- a/Sources/SqlDatabase/Configuration/AssemblyScriptConfiguration.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Configuration; - -namespace SqlDatabase.Configuration; - -public sealed class AssemblyScriptConfiguration : ConfigurationElement -{ - private const string PropertyClassName = "className"; - private const string PropertyMethodName = "methodName"; - - public AssemblyScriptConfiguration() - { - } - - public AssemblyScriptConfiguration(string className, string methodName) - { - ClassName = className; - MethodName = methodName; - } - - [ConfigurationProperty(PropertyClassName, DefaultValue = "SqlDatabaseScript")] - public string ClassName - { - get => (string)this[PropertyClassName]; - set => this[PropertyClassName] = value; - } - - [ConfigurationProperty(PropertyMethodName, DefaultValue = "Execute")] - public string MethodName - { - get => (string)this[PropertyMethodName]; - set => this[PropertyMethodName] = value; - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/CommandLine.create.net452.txt b/Sources/SqlDatabase/Configuration/CommandLine.create.net472.txt similarity index 100% rename from Sources/SqlDatabase/Configuration/CommandLine.create.net452.txt rename to Sources/SqlDatabase/Configuration/CommandLine.create.net472.txt diff --git a/Sources/SqlDatabase/Configuration/CommandLine.cs b/Sources/SqlDatabase/Configuration/CommandLine.cs index d123bce7..77e1a669 100644 --- a/Sources/SqlDatabase/Configuration/CommandLine.cs +++ b/Sources/SqlDatabase/Configuration/CommandLine.cs @@ -2,9 +2,9 @@ namespace SqlDatabase.Configuration; -internal struct CommandLine +internal readonly struct CommandLine { - public CommandLine(IList args, string[] original) + public CommandLine(IList args, string[]? original) { Args = args; Original = original; @@ -18,5 +18,5 @@ public CommandLine(params Arg[] args) public IList Args { get; } - public string[] Original { get; } + public string[]? Original { get; } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/CommandLine.execute.net452.txt b/Sources/SqlDatabase/Configuration/CommandLine.execute.net472.txt similarity index 100% rename from Sources/SqlDatabase/Configuration/CommandLine.execute.net452.txt rename to Sources/SqlDatabase/Configuration/CommandLine.execute.net472.txt diff --git a/Sources/SqlDatabase/Configuration/CommandLine.export.net452.txt b/Sources/SqlDatabase/Configuration/CommandLine.export.net472.txt similarity index 100% rename from Sources/SqlDatabase/Configuration/CommandLine.export.net452.txt rename to Sources/SqlDatabase/Configuration/CommandLine.export.net472.txt diff --git a/Sources/SqlDatabase/Configuration/CommandLine.upgrade.net452.txt b/Sources/SqlDatabase/Configuration/CommandLine.upgrade.net472.txt similarity index 100% rename from Sources/SqlDatabase/Configuration/CommandLine.upgrade.net452.txt rename to Sources/SqlDatabase/Configuration/CommandLine.upgrade.net472.txt diff --git a/Sources/SqlDatabase/Configuration/CommandLineBase.cs b/Sources/SqlDatabase/Configuration/CommandLineBase.cs index 2116d8c4..ad5d9ff2 100644 --- a/Sources/SqlDatabase/Configuration/CommandLineBase.cs +++ b/Sources/SqlDatabase/Configuration/CommandLineBase.cs @@ -1,21 +1,20 @@ using System; using System.Collections.Generic; -using System.Linq; +using SqlDatabase.Adapter; using SqlDatabase.Commands; -using SqlDatabase.IO; -using SqlDatabase.Scripts; +using SqlDatabase.FileSystem; namespace SqlDatabase.Configuration; internal abstract class CommandLineBase : ICommandLine { - public string ConnectionString { get; set; } + public string? ConnectionString { get; set; } public IList Scripts { get; } = new List(); public IDictionary Variables { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase); - public string ConfigurationFile { get; set; } + public string? ConfigurationFile { get; set; } public IFileSystemFactory FileSystemFactory { get; set; } = new FileSystemFactory(); @@ -28,12 +27,12 @@ public void Parse(CommandLine args) if (string.IsNullOrWhiteSpace(ConnectionString)) { - throw new InvalidCommandLineException("Options {0} is not specified.".FormatWith(Arg.Database)); + throw new InvalidCommandLineException($"Options {Arg.Database} is not specified."); } if (Scripts.Count == 0) { - throw new InvalidCommandLineException("Options {0} is not specified.".FormatWith(Arg.Scripts)); + throw new InvalidCommandLineException($"Options {Arg.Scripts} is not specified."); } Validate(); @@ -41,58 +40,6 @@ public void Parse(CommandLine args) public abstract ICommand CreateCommand(ILogger logger); - internal Database CreateDatabase(ILogger logger, IConfigurationManager configuration, TransactionMode transaction, bool whatIf) - { - IDatabaseAdapter adapter; - try - { - adapter = DatabaseAdapterFactory.CreateAdapter(ConnectionString, configuration.SqlDatabase, logger); - } - catch (Exception ex) - { - throw new InvalidCommandLineException(Arg.Database, "Invalid connection string value.", ex); - } - - var database = new Database - { - Adapter = adapter, - Log = logger, - Transaction = transaction, - WhatIf = whatIf - }; - - var configurationVariables = configuration.SqlDatabase.Variables; - foreach (var name in configurationVariables.AllKeys) - { - database.Variables.SetValue(VariableSource.ConfigurationFile, name, configurationVariables[name].Value); - } - - foreach (var entry in Variables) - { - database.Variables.SetValue(VariableSource.CommandLine, entry.Key, entry.Value); - } - - var invalidNames = database - .Variables - .GetNames() - .OrderBy(i => i) - .Where(i => !SqlScriptVariableParser.IsValidVariableName(i)) - .Select(i => "[{0}]".FormatWith(i)) - .ToList(); - - if (invalidNames.Count == 1) - { - throw new InvalidOperationException("The variable name {0} is invalid.".FormatWith(invalidNames[0])); - } - - if (invalidNames.Count > 1) - { - throw new InvalidOperationException("The following variable names are invalid: {0}.".FormatWith(string.Join(", ", invalidNames))); - } - - return database; - } - protected internal virtual void Validate() { } @@ -122,10 +69,15 @@ protected virtual bool ParseArg(Arg arg) return false; } - protected void SetInLineScript(string value) + protected void SetInLineScript(string? value) { + if (string.IsNullOrEmpty(value)) + { + return; + } + var index = Scripts.Count + 1; - var script = FileSystemFactory.FromContent("from{0}.sql".FormatWith(index), value); + var script = FileSystemFactory.FromContent($"from{index}.sql", value!); Scripts.Add(script); } @@ -143,12 +95,12 @@ private void ApplyArg(Arg arg) } catch (Exception ex) { - throw new InvalidCommandLineException("Fail to parse option [{0}].".FormatWith(arg), ex); + throw new InvalidCommandLineException($"Fail to parse option [{arg}].", ex); } if (!isParsed) { - throw new InvalidCommandLineException("Unknown option [{0}].".FormatWith(arg)); + throw new InvalidCommandLineException($"Unknown option [{arg}]."); } } @@ -166,7 +118,7 @@ private bool TryParseKnownPair(Arg arg) return true; } - if (arg.Key.StartsWith(Arg.Variable, StringComparison.OrdinalIgnoreCase)) + if (arg.Key != null && arg.Key.StartsWith(Arg.Variable, StringComparison.OrdinalIgnoreCase)) { SetVariable(arg.Key.Substring(Arg.Variable.Length), arg.Value); return true; @@ -181,28 +133,28 @@ private bool TryParseKnownPair(Arg arg) return false; } - private void SetScripts(string value) + private void SetScripts(string? value) { Scripts.Add(FileSystemFactory.FileSystemInfoFromPath(value)); } - private void SetVariable(string name, string value) + private void SetVariable(string? name, string? value) { name = name?.Trim(); if (string.IsNullOrEmpty(name)) { - throw new InvalidCommandLineException(Arg.Variable, "Invalid variable name [{0}].".FormatWith(name)); + throw new InvalidCommandLineException(Arg.Variable, $"Invalid variable name [{name}]."); } - if (Variables.ContainsKey(name)) + if (Variables.ContainsKey(name!)) { - throw new InvalidCommandLineException(Arg.Variable, "Variable with name [{0}] is duplicated.".FormatWith(name)); + throw new InvalidCommandLineException(Arg.Variable, $"Variable with name [{name}] is duplicated."); } - Variables.Add(name, value); + Variables.Add(name!, value ?? string.Empty); } - private void SetConfigurationFile(string configurationFile) + private void SetConfigurationFile(string? configurationFile) { ConfigurationFile = configurationFile; } diff --git a/Sources/SqlDatabase/Configuration/CommandLineFactory.cs b/Sources/SqlDatabase/Configuration/CommandLineFactory.cs index b50348a0..1aa4aa41 100644 --- a/Sources/SqlDatabase/Configuration/CommandLineFactory.cs +++ b/Sources/SqlDatabase/Configuration/CommandLineFactory.cs @@ -13,7 +13,7 @@ internal sealed class CommandLineFactory public CommandLine Args { get; set; } - public string ActiveCommandName { get; private set; } + public string ActiveCommandName { get; private set; } = null!; public bool ShowCommandHelp { get; private set; } @@ -30,12 +30,12 @@ public bool Bind() throw new InvalidCommandLineException(" not found."); } - ActiveCommandName = commandArgs[0].Value; + ActiveCommandName = commandArgs[0].Value!; var command = CreateCommand(ActiveCommandName); if (command == null) { - throw new InvalidCommandLineException("Unknown command [{0}].".FormatWith(ActiveCommandName)); + throw new InvalidCommandLineException($"Unknown command [{ActiveCommandName}]."); } commandArgs.RemoveAt(0); @@ -58,14 +58,14 @@ public bool Bind() return true; } - public ICommandLine Resolve() + public ICommandLine? Resolve() { var command = CreateCommand(ActiveCommandName); - command.Parse(Args); + command?.Parse(Args); return command; } - internal static ICommandLine CreateCommand(string name) + internal static ICommandLine? CreateCommand(string? name) { if (CommandCreate.Equals(name, StringComparison.OrdinalIgnoreCase)) { diff --git a/Sources/SqlDatabase/Configuration/CommandLineParser.cs b/Sources/SqlDatabase/Configuration/CommandLineParser.cs index 000012e8..aec19af6 100644 --- a/Sources/SqlDatabase/Configuration/CommandLineParser.cs +++ b/Sources/SqlDatabase/Configuration/CommandLineParser.cs @@ -5,7 +5,7 @@ namespace SqlDatabase.Configuration; internal sealed class CommandLineParser { - public static string GetLogFileName(IList args) + public static string? GetLogFileName(IList args) { for (var i = 0; i < args.Count; i++) { @@ -27,7 +27,7 @@ public CommandLine Parse(params string[] args) { if (!ParseArg(arg, out var value)) { - throw new InvalidCommandLineException("Invalid option [{0}].".FormatWith(arg)); + throw new InvalidCommandLineException($"Invalid option [{arg}]."); } if (!IsLog(value)) @@ -63,7 +63,7 @@ internal static bool ParseArg(string input, out Arg arg) return true; } - private static bool SplitKeyValue(string keyValue, int offset, out string key, out string value) + private static bool SplitKeyValue(string keyValue, int offset, out string key, out string? value) { keyValue = keyValue.Substring(offset); key = keyValue; diff --git a/Sources/SqlDatabase/Configuration/ConfigurationManager.cs b/Sources/SqlDatabase/Configuration/ConfigurationManager.cs deleted file mode 100644 index 5e9cb067..00000000 --- a/Sources/SqlDatabase/Configuration/ConfigurationManager.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Configuration; -using System.IO; -using System.Linq; -using System.Reflection; -using SqlDatabase.IO; -using Manager = System.Configuration.ConfigurationManager; - -namespace SqlDatabase.Configuration; - -internal sealed class ConfigurationManager : IConfigurationManager -{ - public AppConfiguration SqlDatabase { get; private set; } - - public static string ResolveDefaultConfigurationFile(string probingPath) - { - var fileName = ResolveFile(new FileSystemFolder(probingPath)).Name; - - return Path.Combine(probingPath, fileName); - } - - public void LoadFrom(string configurationFile) - { - try - { - var info = string.IsNullOrEmpty(configurationFile) ? null : FileSystemFactory.FileSystemInfoFromPath(configurationFile); - LoadFrom(info); - } - catch (Exception ex) when ((ex as IOException) == null) - { - throw new ConfigurationErrorsException("Fail to load configuration from [{0}].".FormatWith(configurationFile), ex); - } - } - - internal void LoadFrom(IFileSystemInfo info) - { - AppConfiguration section; - if (info == null) - { - section = LoadCurrent(); - } - else - { - section = Load(info); - } - - SqlDatabase = section ?? new AppConfiguration(); - } - - private static AppConfiguration LoadCurrent() - { - return (AppConfiguration)Manager.GetSection(AppConfiguration.SectionName); - } - - private static AppConfiguration Load(IFileSystemInfo info) - { - var file = ResolveFile(info); - - var tempFile = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); - try - { - using (var destination = new FileStream(tempFile, FileMode.Create, FileAccess.ReadWrite)) - using (var source = file.OpenRead()) - { - source.CopyTo(destination); - } - - var configuration = Manager.OpenMappedExeConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = tempFile }, ConfigurationUserLevel.None); - return (AppConfiguration)configuration.GetSection(AppConfiguration.SectionName); - } - finally - { - if (File.Exists(tempFile)) - { - File.Delete(tempFile); - } - } - } - - private static IFile ResolveFile(IFileSystemInfo info) - { - IFile file; - if (info is IFolder folder) - { - const string Name1 = "SqlDatabase.exe.config"; - const string Name2 = "SqlDatabase.dll.config"; - - var fileName = Path.GetFileName(typeof(ConfigurationManager).Assembly.Location) + ".config"; - file = folder - .GetFiles() - .Where(i => Name1.Equals(i.Name, StringComparison.OrdinalIgnoreCase) || Name2.Equals(i.Name, StringComparison.OrdinalIgnoreCase)) - .OrderByDescending(i => i.Name, StringComparer.OrdinalIgnoreCase) - .FirstOrDefault(); - - if (file == null) - { - throw new FileNotFoundException("Configuration file {0} not found in {1}.".FormatWith(fileName, info.Name)); - } - } - else - { - file = (IFile)info; - } - - return file; - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/CreateCommandLine.cs b/Sources/SqlDatabase/Configuration/CreateCommandLine.cs index bf27f249..6556c3c8 100644 --- a/Sources/SqlDatabase/Configuration/CreateCommandLine.cs +++ b/Sources/SqlDatabase/Configuration/CreateCommandLine.cs @@ -1,47 +1,36 @@ -using System.Linq; +using SqlDatabase.Adapter; using SqlDatabase.Commands; -using SqlDatabase.Scripts; -using SqlDatabase.Scripts.PowerShellInternal; namespace SqlDatabase.Configuration; internal sealed class CreateCommandLine : CommandLineBase { - public string UsePowerShell { get; set; } + public string? UsePowerShell { get; set; } public bool WhatIf { get; set; } - public override ICommand CreateCommand(ILogger logger) - { - var configuration = new ConfigurationManager(); - configuration.LoadFrom(ConfigurationFile); - - var powerShellFactory = PowerShellFactory.Create(UsePowerShell); - var database = CreateDatabase(logger, configuration, TransactionMode.None, WhatIf); + public override ICommand CreateCommand(ILogger logger) => CreateCommand(logger, new EnvironmentBuilder()); - var sequence = new CreateScriptSequence - { - ScriptFactory = new ScriptFactory - { - AssemblyScriptConfiguration = configuration.SqlDatabase.AssemblyScript, - PowerShellFactory = powerShellFactory, - TextReader = database.Adapter.CreateSqlTextReader() - }, - Sources = Scripts.ToArray() - }; - - return new DatabaseCreateCommand - { - Log = logger, - Database = database, - ScriptSequence = sequence, - PowerShellFactory = powerShellFactory - }; + internal ICommand CreateCommand(ILogger logger, IEnvironmentBuilder builder) + { + builder + .WithLogger(logger) + .WithConfiguration(ConfigurationFile) + .WithPowerShellScripts(UsePowerShell) + .WithAssemblyScripts() + .WithVariables(Variables) + .WithDataBase(ConnectionString!, TransactionMode.None, WhatIf); + + var database = builder.BuildDatabase(); + var scriptResolver = builder.BuildScriptResolver(); + var sequence = builder.BuildCreateSequence(Scripts); + + return new DatabaseCreateCommand(sequence, scriptResolver, database, logger); } protected override bool ParseArg(Arg arg) { -#if NETCOREAPP || NET5_0_OR_GREATER +#if NET5_0_OR_GREATER if (Arg.UsePowerShell.Equals(arg.Key, System.StringComparison.OrdinalIgnoreCase)) { UsePowerShell = arg.Value; diff --git a/Sources/SqlDatabase/Configuration/DatabaseConfiguration.cs b/Sources/SqlDatabase/Configuration/DatabaseConfiguration.cs deleted file mode 100644 index ce3fda3c..00000000 --- a/Sources/SqlDatabase/Configuration/DatabaseConfiguration.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Configuration; - -namespace SqlDatabase.Configuration; - -public sealed class DatabaseConfiguration : ConfigurationElement -{ - private const string PropertyGetCurrentVersionScript = "getCurrentVersion"; - private const string PropertySetCurrentVersionScript = "setCurrentVersion"; - private const string PropertyVariables = "variables"; - - [ConfigurationProperty(PropertyGetCurrentVersionScript)] - public string GetCurrentVersionScript - { - get => (string)this[PropertyGetCurrentVersionScript]; - set => this[PropertyGetCurrentVersionScript] = value; - } - - [ConfigurationProperty(PropertySetCurrentVersionScript)] - public string SetCurrentVersionScript - { - get => (string)this[PropertySetCurrentVersionScript]; - set => this[PropertySetCurrentVersionScript] = value; - } - - [ConfigurationProperty(PropertyVariables)] - public NameValueConfigurationCollection Variables => (NameValueConfigurationCollection)this[PropertyVariables]; -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/EchoCommandLine.cs b/Sources/SqlDatabase/Configuration/EchoCommandLine.cs index 83092902..9d40232f 100644 --- a/Sources/SqlDatabase/Configuration/EchoCommandLine.cs +++ b/Sources/SqlDatabase/Configuration/EchoCommandLine.cs @@ -1,4 +1,5 @@ -using SqlDatabase.Commands; +using SqlDatabase.Adapter; +using SqlDatabase.Commands; namespace SqlDatabase.Configuration; @@ -11,12 +12,5 @@ public void Parse(CommandLine args) _args = args; } - public ICommand CreateCommand(ILogger logger) - { - return new EchoCommand - { - Logger = logger, - Args = _args - }; - } + public ICommand CreateCommand(ILogger logger) => new EchoCommand(logger, _args); } \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/EnvironmentBuilder.cs b/Sources/SqlDatabase/Configuration/EnvironmentBuilder.cs new file mode 100644 index 00000000..8061a7d3 --- /dev/null +++ b/Sources/SqlDatabase/Configuration/EnvironmentBuilder.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlDatabase.Adapter; +using SqlDatabase.Adapter.AssemblyScripts; +using SqlDatabase.Adapter.PowerShellScripts; +using SqlDatabase.Adapter.Sql; +using SqlDatabase.FileSystem; +using SqlDatabase.Scripts; +using SqlDatabase.Sequence; + +namespace SqlDatabase.Configuration; + +internal sealed class EnvironmentBuilder : IEnvironmentBuilder +{ + private ILogger? _logger; + private AppConfiguration? _configuration; + private string? _connectionString; + private TransactionMode _transactionMode; + private bool _whatIf; + private IDictionary? _variables; + private PowerShellScriptFactory? _powerShellScript; + private AssemblyScriptFactory? _assemblyScript; + private ScriptResolver? _scriptResolver; + private IDatabase? _database; + + public IEnvironmentBuilder WithConfiguration(string? configurationFile) + { + var configuration = new ConfigurationManager(); + configuration.LoadFrom(configurationFile); + + return WithConfiguration(configuration.SqlDatabase); + } + + public IEnvironmentBuilder WithLogger(ILogger logger) + { + _logger = logger; + + return this; + } + + public IEnvironmentBuilder WithPowerShellScripts(string? installationPath) + { + _powerShellScript = new PowerShellScriptFactory(installationPath); + return this; + } + + public IEnvironmentBuilder WithAssemblyScripts() + { + var configuration = GetConfiguration().AssemblyScript; + _assemblyScript = new AssemblyScriptFactory(configuration.ClassName, configuration.MethodName); + return this; + } + + public IEnvironmentBuilder WithVariables(IDictionary variables) + { + _variables = variables; + return this; + } + + public IEnvironmentBuilder WithDataBase(string connectionString, TransactionMode transaction, bool whatIf) + { + _connectionString = connectionString; + _transactionMode = transaction; + _whatIf = whatIf; + return this; + } + + public IDatabase BuildDatabase() + { + if (_database == null) + { + _database = CreateDatabase(); + } + + return _database; + } + + public IScriptResolver BuildScriptResolver() + { + if (_scriptResolver == null) + { + _scriptResolver = CreateScriptResolver(); + } + + return _scriptResolver; + } + + public IUpgradeScriptSequence BuildUpgradeSequence(IList scripts, bool folderAsModuleName) + { + var scriptResolver = (ScriptResolver)BuildScriptResolver(); + var database = BuildDatabase(); + + return new UpgradeScriptSequence( + scriptResolver, + database.GetCurrentVersion, + scripts.ToArray(), + GetLogger(), + folderAsModuleName, + _whatIf); + } + + public ICreateScriptSequence BuildCreateSequence(IList scripts) + { + var scriptResolver = (ScriptResolver)BuildScriptResolver(); + return new CreateScriptSequence(scripts.ToArray(), scriptResolver); + } + + internal IEnvironmentBuilder WithConfiguration(AppConfiguration configuration) + { + _configuration = configuration; + return this; + } + + private Database CreateDatabase() + { + if (_connectionString == null || _variables == null) + { + throw new InvalidOperationException(); + } + + IDatabaseAdapter adapter; + try + { + adapter = DatabaseAdapterFactory.CreateAdapter(_connectionString, GetConfiguration(), GetLogger()); + } + catch (Exception ex) + { + throw new InvalidCommandLineException(Arg.Database, "Invalid connection string value.", ex); + } + + var database = new Database(adapter, GetLogger(), _transactionMode, _whatIf); + + var configurationVariables = GetConfiguration().Variables; + foreach (var name in configurationVariables.Keys) + { + database.Variables.SetValue(VariableSource.ConfigurationFile, name, configurationVariables[name]); + } + + foreach (var entry in _variables) + { + database.Variables.SetValue(VariableSource.CommandLine, entry.Key, entry.Value); + } + + var invalidNames = database + .Variables + .GetNames() + .OrderBy(i => i) + .Where(i => !SqlScriptVariableParser.IsValidVariableName(i)) + .Select(i => $"[{i}]") + .ToList(); + + if (invalidNames.Count == 1) + { + throw new InvalidOperationException($"The variable name {invalidNames[0]} is invalid."); + } + + if (invalidNames.Count > 1) + { + throw new InvalidOperationException($"The following variable names are invalid: {string.Join(", ", invalidNames)}."); + } + + return database; + } + + private ScriptResolver CreateScriptResolver() + { + var factories = new List(3); + + factories.Add(new TextScriptFactory(BuildDatabase().Adapter.CreateSqlTextReader())); + + if (_powerShellScript != null) + { + factories.Add(_powerShellScript); + } + + if (_assemblyScript != null) + { + factories.Add(_assemblyScript); + } + + return new ScriptResolver(factories.ToArray()); + } + + private AppConfiguration GetConfiguration() + { + if (_configuration == null) + { + throw new InvalidOperationException(); + } + + return _configuration; + } + + private ILogger GetLogger() + { + if (_logger == null) + { + throw new InvalidOperationException(); + } + + return _logger; + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/ExecuteCommandLine.cs b/Sources/SqlDatabase/Configuration/ExecuteCommandLine.cs index 3fc11ed2..b8158def 100644 --- a/Sources/SqlDatabase/Configuration/ExecuteCommandLine.cs +++ b/Sources/SqlDatabase/Configuration/ExecuteCommandLine.cs @@ -1,8 +1,6 @@ using System; -using System.Linq; +using SqlDatabase.Adapter; using SqlDatabase.Commands; -using SqlDatabase.Scripts; -using SqlDatabase.Scripts.PowerShellInternal; namespace SqlDatabase.Configuration; @@ -10,36 +8,27 @@ internal sealed class ExecuteCommandLine : CommandLineBase { public TransactionMode Transaction { get; set; } - public string UsePowerShell { get; set; } + public string? UsePowerShell { get; set; } public bool WhatIf { get; set; } - public override ICommand CreateCommand(ILogger logger) - { - var configuration = new ConfigurationManager(); - configuration.LoadFrom(ConfigurationFile); + public override ICommand CreateCommand(ILogger logger) => CreateCommand(logger, new EnvironmentBuilder()); - var powerShellFactory = PowerShellFactory.Create(UsePowerShell); - var database = CreateDatabase(logger, configuration, TransactionMode.None, WhatIf); + internal ICommand CreateCommand(ILogger logger, IEnvironmentBuilder builder) + { + builder + .WithLogger(logger) + .WithConfiguration(ConfigurationFile) + .WithPowerShellScripts(UsePowerShell) + .WithAssemblyScripts() + .WithVariables(Variables) + .WithDataBase(ConnectionString!, Transaction, WhatIf); - var sequence = new CreateScriptSequence - { - ScriptFactory = new ScriptFactory - { - AssemblyScriptConfiguration = configuration.SqlDatabase.AssemblyScript, - PowerShellFactory = powerShellFactory, - TextReader = database.Adapter.CreateSqlTextReader() - }, - Sources = Scripts.ToArray() - }; + var database = builder.BuildDatabase(); + var scriptResolver = builder.BuildScriptResolver(); + var sequence = builder.BuildCreateSequence(Scripts); - return new DatabaseExecuteCommand - { - Log = logger, - Database = database, - ScriptSequence = sequence, - PowerShellFactory = powerShellFactory - }; + return new DatabaseExecuteCommand(sequence, scriptResolver, database, logger); } protected override bool ParseArg(Arg arg) @@ -56,7 +45,7 @@ protected override bool ParseArg(Arg arg) return true; } -#if NETCOREAPP || NET5_0_OR_GREATER +#if NET5_0_OR_GREATER if (Arg.UsePowerShell.Equals(arg.Key, StringComparison.OrdinalIgnoreCase)) { UsePowerShell = arg.Value; @@ -72,11 +61,11 @@ protected override bool ParseArg(Arg arg) return false; } - private void SetTransaction(string modeName) + private void SetTransaction(string? modeName) { if (!Enum.TryParse(modeName, true, out var mode)) { - throw new InvalidCommandLineException(Arg.Transaction, "Unknown transaction mode [{0}].".FormatWith(modeName)); + throw new InvalidCommandLineException(Arg.Transaction, $"Unknown transaction mode [{modeName}]."); } Transaction = mode; diff --git a/Sources/SqlDatabase/Configuration/ExportCommandLine.cs b/Sources/SqlDatabase/Configuration/ExportCommandLine.cs index b3821385..e968de25 100644 --- a/Sources/SqlDatabase/Configuration/ExportCommandLine.cs +++ b/Sources/SqlDatabase/Configuration/ExportCommandLine.cs @@ -1,41 +1,38 @@ using System; using System.IO; -using System.Linq; +using SqlDatabase.Adapter; +using SqlDatabase.Adapter.Sql.Export; using SqlDatabase.Commands; -using SqlDatabase.Export; -using SqlDatabase.Scripts; namespace SqlDatabase.Configuration; internal sealed class ExportCommandLine : CommandLineBase { - public string DestinationTableName { get; set; } + public string? DestinationTableName { get; set; } - public string DestinationFileName { get; set; } + public string? DestinationFileName { get; set; } - public override ICommand CreateCommand(ILogger logger) - { - var configuration = new ConfigurationManager(); - configuration.LoadFrom(ConfigurationFile); + public override ICommand CreateCommand(ILogger logger) => CreateCommand(logger, new EnvironmentBuilder()); - var database = CreateDatabase(logger, configuration, TransactionMode.None, false); + internal ICommand CreateCommand(ILogger logger, IEnvironmentBuilder builder) + { + builder + .WithLogger(logger) + .WithConfiguration(ConfigurationFile) + .WithVariables(Variables) + .WithDataBase(ConnectionString!, TransactionMode.None, false); - var sequence = new CreateScriptSequence - { - ScriptFactory = new ScriptFactory - { - AssemblyScriptConfiguration = configuration.SqlDatabase.AssemblyScript, - TextReader = database.Adapter.CreateSqlTextReader() - }, - Sources = Scripts.ToArray() - }; + var database = builder.BuildDatabase(); + var scriptResolver = builder.BuildScriptResolver(); + var sequence = builder.BuildCreateSequence(Scripts); - return new DatabaseExportCommand + return new DatabaseExportCommand( + sequence, + scriptResolver, + CreateOutput(), + database, + WrapLogger(logger)) { - Log = WrapLogger(logger), - OpenOutput = CreateOutput(), - Database = database, - ScriptSequence = sequence, DestinationTableName = DestinationTableName }; } diff --git a/Sources/SqlDatabase/Configuration/GenericCommandLine.cs b/Sources/SqlDatabase/Configuration/GenericCommandLine.cs index 120f26e3..a6214ceb 100644 --- a/Sources/SqlDatabase/Configuration/GenericCommandLine.cs +++ b/Sources/SqlDatabase/Configuration/GenericCommandLine.cs @@ -5,9 +5,9 @@ namespace SqlDatabase.Configuration; public sealed class GenericCommandLine { - public string Command { get; set; } + public string? Command { get; set; } - public string Connection { get; set; } + public string? Connection { get; set; } public TransactionMode Transaction { get; set; } @@ -17,15 +17,15 @@ public sealed class GenericCommandLine public IDictionary Variables { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase); - public string ConfigurationFile { get; set; } + public string? ConfigurationFile { get; set; } - public string ExportToTable { get; set; } + public string? ExportToTable { get; set; } - public string ExportToFile { get; set; } + public string? ExportToFile { get; set; } public bool WhatIf { get; set; } public bool FolderAsModuleName { get; set; } - public string LogFileName { get; set; } + public string? LogFileName { get; set; } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/GenericCommandLineBuilder.cs b/Sources/SqlDatabase/Configuration/GenericCommandLineBuilder.cs index 189ce217..c49d3814 100644 --- a/Sources/SqlDatabase/Configuration/GenericCommandLineBuilder.cs +++ b/Sources/SqlDatabase/Configuration/GenericCommandLineBuilder.cs @@ -49,20 +49,20 @@ public GenericCommandLineBuilder SetTransaction(TransactionMode mode) return this; } - public GenericCommandLineBuilder SetVariable(string name, string value) + public GenericCommandLineBuilder SetVariable(string? name, string? value) { name = name?.Trim(); if (string.IsNullOrEmpty(name)) { - throw new InvalidCommandLineException(Arg.Variable, "Invalid variable name [{0}].".FormatWith(name)); + throw new InvalidCommandLineException(Arg.Variable, $"Invalid variable name [{name}]."); } - if (Line.Variables.ContainsKey(name)) + if (Line.Variables.ContainsKey(name!)) { - throw new InvalidCommandLineException(Arg.Variable, "Variable with name [{0}] is duplicated.".FormatWith(name)); + throw new InvalidCommandLineException(Arg.Variable, $"Variable with name [{name}] is duplicated."); } - Line.Variables.Add(name, value); + Line.Variables.Add(name!, value ?? string.Empty); return this; } @@ -72,25 +72,25 @@ public GenericCommandLineBuilder SetVariable(string nameValue) if (!CommandLineParser.ParseArg(Arg.Sign + nameValue, out var arg) || !arg.IsPair) { - throw new InvalidCommandLineException(Arg.Variable, "Invalid variable value definition [{0}].".FormatWith(nameValue)); + throw new InvalidCommandLineException(Arg.Variable, $"Invalid variable value definition [{nameValue}]."); } return SetVariable(arg.Key, arg.Value); } - public GenericCommandLineBuilder SetConfigurationFile(string configurationFile) + public GenericCommandLineBuilder SetConfigurationFile(string? configurationFile) { Line.ConfigurationFile = configurationFile; return this; } - public GenericCommandLineBuilder SetExportToTable(string name) + public GenericCommandLineBuilder SetExportToTable(string? name) { Line.ExportToTable = name; return this; } - public GenericCommandLineBuilder SetExportToFile(string fileName) + public GenericCommandLineBuilder SetExportToFile(string? fileName) { Line.ExportToFile = fileName; return this; @@ -108,7 +108,7 @@ public GenericCommandLineBuilder SetFolderAsModuleName(bool value) return this; } - public GenericCommandLineBuilder SetLogFileName(string fileName) + public GenericCommandLineBuilder SetLogFileName(string? fileName) { Line.LogFileName = fileName; return this; @@ -125,8 +125,8 @@ public string[] BuildArray() var result = new List { - cmd.Command, - CombineArg(Arg.Database, cmd.Connection) + cmd.Command!, + CombineArg(Arg.Database, cmd.Connection!) }; foreach (var script in cmd.Scripts) @@ -146,17 +146,17 @@ public string[] BuildArray() if (!string.IsNullOrEmpty(cmd.ConfigurationFile)) { - result.Add(CombineArg(Arg.Configuration, cmd.ConfigurationFile)); + result.Add(CombineArg(Arg.Configuration, cmd.ConfigurationFile!)); } if (!string.IsNullOrEmpty(cmd.ExportToTable)) { - result.Add(CombineArg(Arg.ExportToTable, cmd.ExportToTable)); + result.Add(CombineArg(Arg.ExportToTable, cmd.ExportToTable!)); } if (!string.IsNullOrEmpty(cmd.ExportToFile)) { - result.Add(CombineArg(Arg.ExportToFile, cmd.ExportToFile)); + result.Add(CombineArg(Arg.ExportToFile, cmd.ExportToFile!)); } foreach (var entry in cmd.Variables) @@ -176,7 +176,7 @@ public string[] BuildArray() if (!string.IsNullOrEmpty(cmd.LogFileName)) { - result.Add(CombineArg(Arg.Log, cmd.LogFileName)); + result.Add(CombineArg(Arg.Log, cmd.LogFileName!)); } return result.ToArray(); diff --git a/Sources/SqlDatabase/Configuration/ICommandLine.cs b/Sources/SqlDatabase/Configuration/ICommandLine.cs index fbf5ef51..a16d5062 100644 --- a/Sources/SqlDatabase/Configuration/ICommandLine.cs +++ b/Sources/SqlDatabase/Configuration/ICommandLine.cs @@ -1,4 +1,5 @@ -using SqlDatabase.Commands; +using SqlDatabase.Adapter; +using SqlDatabase.Commands; namespace SqlDatabase.Configuration; diff --git a/Sources/SqlDatabase/Configuration/IEnvironmentBuilder.cs b/Sources/SqlDatabase/Configuration/IEnvironmentBuilder.cs new file mode 100644 index 00000000..47d7e0b9 --- /dev/null +++ b/Sources/SqlDatabase/Configuration/IEnvironmentBuilder.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; +using SqlDatabase.Scripts; +using SqlDatabase.Sequence; + +namespace SqlDatabase.Configuration; + +internal interface IEnvironmentBuilder +{ + IEnvironmentBuilder WithConfiguration(string? configurationFile); + + IEnvironmentBuilder WithLogger(ILogger logger); + + IEnvironmentBuilder WithPowerShellScripts(string? installationPath); + + IEnvironmentBuilder WithAssemblyScripts(); + + IEnvironmentBuilder WithVariables(IDictionary variables); + + IEnvironmentBuilder WithDataBase(string connectionString, TransactionMode transaction, bool whatIf); + + IDatabase BuildDatabase(); + + IScriptResolver BuildScriptResolver(); + + IUpgradeScriptSequence BuildUpgradeSequence(IList scripts, bool folderAsModuleName); + + ICreateScriptSequence BuildCreateSequence(IList scripts); +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/InvalidCommandLineException.cs b/Sources/SqlDatabase/Configuration/InvalidCommandLineException.cs index 75ef6fae..253ff89a 100644 --- a/Sources/SqlDatabase/Configuration/InvalidCommandLineException.cs +++ b/Sources/SqlDatabase/Configuration/InvalidCommandLineException.cs @@ -3,8 +3,7 @@ namespace SqlDatabase.Configuration; -[Serializable] -public class InvalidCommandLineException : SystemException +public sealed class InvalidCommandLineException : SystemException { public InvalidCommandLineException() { @@ -32,18 +31,5 @@ public InvalidCommandLineException(string argument, string message, Exception in Argument = argument; } - protected InvalidCommandLineException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - Argument = info.GetString(nameof(Argument)); - } - - public string Argument { get; } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - - info.AddValue(nameof(Argument), Argument); - } + public string? Argument { get; } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Configuration/UpgradeCommandLine.cs b/Sources/SqlDatabase/Configuration/UpgradeCommandLine.cs index 3b2ada29..3d33bff7 100644 --- a/Sources/SqlDatabase/Configuration/UpgradeCommandLine.cs +++ b/Sources/SqlDatabase/Configuration/UpgradeCommandLine.cs @@ -1,9 +1,6 @@ using System; -using System.Linq; +using SqlDatabase.Adapter; using SqlDatabase.Commands; -using SqlDatabase.Scripts; -using SqlDatabase.Scripts.PowerShellInternal; -using SqlDatabase.Scripts.UpgradeInternal; namespace SqlDatabase.Configuration; @@ -11,42 +8,29 @@ internal sealed class UpgradeCommandLine : CommandLineBase { public TransactionMode Transaction { get; set; } - public string UsePowerShell { get; set; } + public string? UsePowerShell { get; set; } public bool FolderAsModuleName { get; set; } public bool WhatIf { get; set; } - public override ICommand CreateCommand(ILogger logger) - { - var configuration = new ConfigurationManager(); - configuration.LoadFrom(ConfigurationFile); - - var database = CreateDatabase(logger, configuration, Transaction, WhatIf); - var powerShellFactory = PowerShellFactory.Create(UsePowerShell); + public override ICommand CreateCommand(ILogger logger) => CreateCommand(logger, new EnvironmentBuilder()); - var sequence = new UpgradeScriptSequence - { - ScriptFactory = new ScriptFactory - { - AssemblyScriptConfiguration = configuration.SqlDatabase.AssemblyScript, - PowerShellFactory = powerShellFactory, - TextReader = database.Adapter.CreateSqlTextReader() - }, - VersionResolver = new ModuleVersionResolver { Database = database, Log = logger }, - Sources = Scripts.ToArray(), - Log = logger, - FolderAsModuleName = FolderAsModuleName, - WhatIf = WhatIf - }; - - return new DatabaseUpgradeCommand - { - Log = logger, - Database = database, - ScriptSequence = sequence, - PowerShellFactory = powerShellFactory - }; + internal ICommand CreateCommand(ILogger logger, IEnvironmentBuilder builder) + { + builder + .WithLogger(logger) + .WithConfiguration(ConfigurationFile) + .WithPowerShellScripts(UsePowerShell) + .WithAssemblyScripts() + .WithVariables(Variables) + .WithDataBase(ConnectionString!, Transaction, WhatIf); + + var database = builder.BuildDatabase(); + var scriptResolver = builder.BuildScriptResolver(); + var sequence = builder.BuildUpgradeSequence(Scripts, FolderAsModuleName); + + return new DatabaseUpgradeCommand(sequence, scriptResolver, database, logger); } protected override bool ParseArg(Arg arg) @@ -63,7 +47,7 @@ protected override bool ParseArg(Arg arg) return true; } -#if NETCOREAPP || NET5_0_OR_GREATER +#if NET5_0_OR_GREATER if (Arg.UsePowerShell.Equals(arg.Key, StringComparison.OrdinalIgnoreCase)) { UsePowerShell = arg.Value; @@ -80,11 +64,11 @@ protected override bool ParseArg(Arg arg) return false; } - private void SetTransaction(string modeName) + private void SetTransaction(string? modeName) { if (!Enum.TryParse(modeName, true, out var mode)) { - throw new InvalidCommandLineException(Arg.Transaction, "Unknown transaction mode [{0}].".FormatWith(modeName)); + throw new InvalidCommandLineException(Arg.Transaction, $"Unknown transaction mode [{modeName}]."); } Transaction = mode; diff --git a/Sources/SqlDatabase/Export/ExportTable.cs b/Sources/SqlDatabase/Export/ExportTable.cs deleted file mode 100644 index 7d2c5660..00000000 --- a/Sources/SqlDatabase/Export/ExportTable.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; - -namespace SqlDatabase.Export; - -internal sealed class ExportTable -{ - public string Name { get; set; } - - public IList Columns { get; } = new List(); -} \ No newline at end of file diff --git a/Sources/SqlDatabase/IO/IFile.cs b/Sources/SqlDatabase/IO/IFile.cs deleted file mode 100644 index dfa709f2..00000000 --- a/Sources/SqlDatabase/IO/IFile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.IO; - -namespace SqlDatabase.IO; - -public interface IFile : IFileSystemInfo -{ - IFolder GetParent(); - - Stream OpenRead(); -} \ No newline at end of file diff --git a/Sources/SqlDatabase/IO/IFileSystemFactory.cs b/Sources/SqlDatabase/IO/IFileSystemFactory.cs deleted file mode 100644 index 895e9405..00000000 --- a/Sources/SqlDatabase/IO/IFileSystemFactory.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SqlDatabase.IO; - -internal interface IFileSystemFactory -{ - IFileSystemInfo FileSystemInfoFromPath(string path); - - IFileSystemInfo FromContent(string name, string content); -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Log/CombinedLogger.cs b/Sources/SqlDatabase/Log/CombinedLogger.cs index 78b8b8bb..12bea88d 100644 --- a/Sources/SqlDatabase/Log/CombinedLogger.cs +++ b/Sources/SqlDatabase/Log/CombinedLogger.cs @@ -1,11 +1,12 @@ using System; +using SqlDatabase.Adapter; namespace SqlDatabase.Log; internal sealed class CombinedLogger : ILogger, IDisposable { - private readonly ILogger _logger1; - private readonly ILogger _logger2; + private readonly ILogger? _logger1; + private readonly ILogger? _logger2; public CombinedLogger(ILogger logger1, bool ownLogger1, ILogger logger2, bool ownLogger2) { @@ -51,10 +52,10 @@ public void Dispose() private sealed class IndentDisposable : IDisposable { - private readonly IDisposable _ident1; - private readonly IDisposable _ident2; + private readonly IDisposable? _ident1; + private readonly IDisposable? _ident2; - public IndentDisposable(IDisposable ident1, IDisposable ident2) + public IndentDisposable(IDisposable? ident1, IDisposable? ident2) { _ident1 = ident1; _ident2 = ident2; diff --git a/Sources/SqlDatabase/Log/DisposableAction.cs b/Sources/SqlDatabase/Log/DisposableAction.cs index df482401..a9d6947e 100644 --- a/Sources/SqlDatabase/Log/DisposableAction.cs +++ b/Sources/SqlDatabase/Log/DisposableAction.cs @@ -4,7 +4,7 @@ namespace SqlDatabase.Log; internal sealed class DisposableAction : IDisposable { - private Action _action; + private Action? _action; public DisposableAction(Action action) { diff --git a/Sources/SqlDatabase/Log/FileLogger.cs b/Sources/SqlDatabase/Log/FileLogger.cs index be471f1c..d3b68e45 100644 --- a/Sources/SqlDatabase/Log/FileLogger.cs +++ b/Sources/SqlDatabase/Log/FileLogger.cs @@ -38,8 +38,8 @@ public FileLogger(string fileName) public void Dispose() { - _writer?.Dispose(); - _file?.Dispose(); + _writer.Dispose(); + _file.Dispose(); } internal void Flush() diff --git a/Sources/SqlDatabase/Log/LoggerBase.cs b/Sources/SqlDatabase/Log/LoggerBase.cs index a42f0a87..9cbad70c 100644 --- a/Sources/SqlDatabase/Log/LoggerBase.cs +++ b/Sources/SqlDatabase/Log/LoggerBase.cs @@ -1,17 +1,18 @@ using System; +using SqlDatabase.Adapter; namespace SqlDatabase.Log; internal abstract class LoggerBase : ILogger { - private string _indentation; + private string? _indentation; public void Error(string message) { WriteError(message); } - public void Info(string message) + public void Info(string? message) { WriteInfo(_indentation + message); } diff --git a/Sources/SqlDatabase/Log/LoggerFactory.cs b/Sources/SqlDatabase/Log/LoggerFactory.cs index 3ff4c6a5..b6b73c22 100644 --- a/Sources/SqlDatabase/Log/LoggerFactory.cs +++ b/Sources/SqlDatabase/Log/LoggerFactory.cs @@ -1,4 +1,6 @@ -namespace SqlDatabase.Log; +using SqlDatabase.Adapter; + +namespace SqlDatabase.Log; internal static class LoggerFactory { diff --git a/Sources/SqlDatabase/Program.cs b/Sources/SqlDatabase/Program.cs index 7c095538..5d4d4539 100644 --- a/Sources/SqlDatabase/Program.cs +++ b/Sources/SqlDatabase/Program.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using SqlDatabase.Adapter; using SqlDatabase.Configuration; using SqlDatabase.Log; @@ -70,7 +71,7 @@ private static bool ExecuteCommand(ICommandLine cmd, ILogger logger) } } - private static ICommandLine ResolveCommandLine(CommandLineFactory factory, ILogger logger) + private static ICommandLine? ResolveCommandLine(CommandLineFactory factory, ILogger logger) { try { @@ -84,7 +85,7 @@ private static ICommandLine ResolveCommandLine(CommandLineFactory factory, ILogg return null; } - private static CommandLineFactory ResolveFactory(string[] args, ILogger logger) + private static CommandLineFactory? ResolveFactory(string[] args, ILogger logger) { try { @@ -105,7 +106,7 @@ private static CommandLineFactory ResolveFactory(string[] args, ILogger logger) return null; } - private static bool TryWrapWithUsersLogger(ILogger logger, string[] args, out CombinedLogger combined) + private static bool TryWrapWithUsersLogger(ILogger logger, string[] args, out CombinedLogger? combined) { combined = null; var fileName = CommandLineParser.GetLogFileName(args); @@ -117,7 +118,7 @@ private static bool TryWrapWithUsersLogger(ILogger logger, string[] args, out Co ILogger fileLogger; try { - fileLogger = new FileLogger(fileName); + fileLogger = new FileLogger(fileName!); } catch (Exception ex) { @@ -131,10 +132,10 @@ private static bool TryWrapWithUsersLogger(ILogger logger, string[] args, out Co private static string GetHelpFileName(string commandName) { -#if NET452 - const string Runtime = ".net452"; +#if NET472 + const string Runtime = ".net472"; #else - const string Runtime = null; + const string? Runtime = null; #endif return "CommandLine." + commandName + Runtime + ".txt"; } @@ -152,11 +153,11 @@ private static string LoadHelpContent(string fileName) if (resourceName == null) { - throw new InvalidOperationException("Help file [{0}] not found.".FormatWith(fullName)); + throw new InvalidOperationException($"Help file [{fullName}] not found."); } using (var stream = scope.Assembly.GetManifestResourceStream(resourceName)) - using (var reader = new StreamReader(stream)) + using (var reader = new StreamReader(stream!)) { return reader.ReadToEnd(); } diff --git a/Sources/SqlDatabase/Properties/AssemblyInfo.cs b/Sources/SqlDatabase/Properties/AssemblyInfo.cs index a31a6ab5..d0e8c551 100644 --- a/Sources/SqlDatabase/Properties/AssemblyInfo.cs +++ b/Sources/SqlDatabase/Properties/AssemblyInfo.cs @@ -1,10 +1,4 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SqlDatabase")] -[assembly: AssemblyDescription("SqlDatabase is a tool for SQL Server, allows executing scripts, database migrations and data export.")] -[assembly: Guid("5ee10884-32f2-443b-b136-66e9a1a3c393")] +using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("SqlDatabase.PowerShell, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] [assembly: InternalsVisibleTo("SqlDatabase.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010055AB0DC1F8A24FB41E7358B65A606EC92141F1ABAFBFF062635AB5FAEB22308CFFBC8B54F3436694F14F6FD6C145D4F16C13A3E739FFCA837902BB78E2D51B890D964CC7384C2CC6B844AE37323F501F29E3EDC2DFADA82C99F5FBB5197ED757D795C2E5408DCB3FBAF9DDDF39E60B137ED0A23603A361EA811E6ADB605DFECC")] diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverSqlConnection.cs b/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverSqlConnection.cs deleted file mode 100644 index 056b7653..00000000 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/ExecuteMethodResolverSqlConnection.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.SqlClient; -using System.Reflection; - -namespace SqlDatabase.Scripts.AssemblyInternal; - -// public void Execute(SqlConnection connection) -internal sealed class ExecuteMethodResolverSqlConnection : ExecuteMethodResolverBase -{ - public override bool IsMatch(MethodInfo method) - { - var parameters = method.GetParameters(); - return parameters.Length == 1 - && typeof(SqlConnection) == parameters[0].ParameterType; - } - - public override Action> CreateDelegate(object instance, MethodInfo method) - { - var execute = (Action)Delegate.CreateDelegate( - typeof(Action), - instance, - method); - - return (command, variables) => execute((SqlConnection)command.Connection); - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/Net452SubDomain.cs b/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/Net452SubDomain.cs deleted file mode 100644 index 5009005a..00000000 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/Net452/Net452SubDomain.cs +++ /dev/null @@ -1,72 +0,0 @@ -#if NET452 -using System; -using System.Data; -using System.IO; - -namespace SqlDatabase.Scripts.AssemblyInternal.Net452 -{ - internal sealed class Net452SubDomain : ISubDomain - { - private DomainDirectory _appBase; - private AppDomain _app; - private DomainAgent _appAgent; - - public ILogger Logger { get; set; } - - public string AssemblyFileName { get; set; } - - public Func ReadAssemblyContent { get; set; } - - public void Initialize() - { - Logger.Info("create domain for {0}".FormatWith(AssemblyFileName)); - - var appBaseName = Path.GetFileName(AssemblyFileName); - _appBase = new DomainDirectory(Logger); - - var entryAssembly = _appBase.SaveFile(ReadAssemblyContent(), appBaseName); - - var setup = new AppDomainSetup - { - ApplicationBase = _appBase.Location, - ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, - LoaderOptimization = LoaderOptimization.MultiDomainHost - }; - - _app = AppDomain.CreateDomain(appBaseName, null, setup); - _appAgent = (DomainAgent)_app.CreateInstanceFromAndUnwrap(GetType().Assembly.Location, typeof(DomainAgent).FullName); - - _appAgent.RedirectConsoleOut(new LoggerProxy(Logger)); - _appAgent.LoadAssembly(entryAssembly); - } - - public void Unload() - { - _appAgent?.BeforeUnload(); - - if (_app != null) - { - AppDomain.Unload(_app); - } - - _app = null; - _appAgent = null; - } - - public bool ResolveScriptExecutor(string className, string methodName) - { - return _appAgent.ResolveScriptExecutor(className, methodName); - } - - public bool Execute(IDbCommand command, IVariables variables) - { - return _appAgent.Execute(command, new VariablesProxy(variables)); - } - - public void Dispose() - { - _appBase?.Dispose(); - } - } -} -#endif \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/NetCore/AssemblyContext.cs b/Sources/SqlDatabase/Scripts/AssemblyInternal/NetCore/AssemblyContext.cs deleted file mode 100644 index bce58315..00000000 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/NetCore/AssemblyContext.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if !NET452 -using System; -using System.IO; -using System.Reflection; -using System.Runtime.Loader; - -namespace SqlDatabase.Scripts.AssemblyInternal.NetCore -{ - internal sealed class AssemblyContext : AssemblyLoadContext - { - public Assembly ScriptAssembly { get; private set; } - - public void LoadScriptAssembly(byte[] assemblyContent) - { - using (var stream = new MemoryStream(assemblyContent)) - { - ScriptAssembly = LoadFromStream(stream); - } - } - - public void UnloadAll() - { - ScriptAssembly = null; - } - - protected override Assembly Load(AssemblyName assemblyName) - { - var isScriptAssembly = assemblyName.Name.Equals(ScriptAssembly.GetName().Name, StringComparison.OrdinalIgnoreCase); - return isScriptAssembly ? ScriptAssembly : null; - } - } -} -#endif \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyInternal/NetCore/NetCoreSubDomain.cs b/Sources/SqlDatabase/Scripts/AssemblyInternal/NetCore/NetCoreSubDomain.cs deleted file mode 100644 index 675df79c..00000000 --- a/Sources/SqlDatabase/Scripts/AssemblyInternal/NetCore/NetCoreSubDomain.cs +++ /dev/null @@ -1,58 +0,0 @@ -#if !NET452 -using System; -using System.Data; - -namespace SqlDatabase.Scripts.AssemblyInternal.NetCore -{ - internal sealed class NetCoreSubDomain : ISubDomain - { - private readonly AssemblyContext _assemblyContext = new AssemblyContext(); - ////private ConsoleListener _consoleRedirect; - - public ILogger Logger { get; set; } - - public string AssemblyFileName { get; set; } - - public Func ReadAssemblyContent { get; set; } - - private IEntryPoint EntryPoint { get; set; } - - public void Initialize() - { - _assemblyContext.LoadScriptAssembly(ReadAssemblyContent()); - - ////_consoleRedirect = new ConsoleListener(Logger); - } - - public void Unload() - { - ////_consoleRedirect?.Dispose(); - - _assemblyContext.UnloadAll(); - } - - public bool ResolveScriptExecutor(string className, string methodName) - { - var resolver = new EntryPointResolver - { - Log = Logger, - ExecutorClassName = className, - ExecutorMethodName = methodName - }; - - EntryPoint = resolver.Resolve(_assemblyContext.ScriptAssembly); - - return EntryPoint != null; - } - - public bool Execute(IDbCommand command, IVariables variables) - { - return EntryPoint.Execute(command, new VariablesProxy(variables)); - } - - public void Dispose() - { - } - } -} -#endif \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/AssemblyScript.cs b/Sources/SqlDatabase/Scripts/AssemblyScript.cs deleted file mode 100644 index 49684069..00000000 --- a/Sources/SqlDatabase/Scripts/AssemblyScript.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Linq; -using SqlDatabase.Configuration; -using SqlDatabase.Scripts.AssemblyInternal; - -namespace SqlDatabase.Scripts; - -internal sealed class AssemblyScript : IScript -{ - public string DisplayName { get; set; } - - public Func ReadAssemblyContent { get; set; } - - public Func ReadDescriptionContent { get; set; } - - public AssemblyScriptConfiguration Configuration { get; set; } - - public void Execute(IDbCommand command, IVariables variables, ILogger logger) - { - var domain = CreateSubDomain(); - - using (domain) - { - domain.Logger = logger; - domain.AssemblyFileName = DisplayName; - domain.ReadAssemblyContent = ReadAssemblyContent; - - try - { - domain.Initialize(); - ResolveScriptExecutor(domain); - Execute(domain, command, variables); - } - finally - { - domain.Unload(); - } - } - } - - public IEnumerable ExecuteReader(IDbCommand command, IVariables variables, ILogger logger) - { - throw new NotSupportedException("Assembly script does not support readers."); - } - - public IList GetDependencies() - { - using (var description = ReadDescriptionContent()) - { - if (description == null) - { - return new ScriptDependency[0]; - } - - using (var reader = new StreamReader(description)) - { - return DependencyParser.ExtractDependencies(reader, DisplayName).ToArray(); - } - } - } - - internal void ResolveScriptExecutor(ISubDomain domain) - { - if (!domain.ResolveScriptExecutor(Configuration.ClassName, Configuration.MethodName)) - { - throw new InvalidOperationException("Fail to resolve script executor."); - } - } - - internal void Execute(ISubDomain domain, IDbCommand command, IVariables variables) - { - if (command != null && !domain.Execute(command, variables)) - { - throw new InvalidOperationException("Errors during script execution."); - } - } - - private ISubDomain CreateSubDomain() - { -#if NET452 - return new AssemblyInternal.Net452.Net452SubDomain(); -#else - return new AssemblyInternal.NetCore.NetCoreSubDomain(); -#endif - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/Database.cs b/Sources/SqlDatabase/Scripts/Database.cs index 9281be8f..ceadcbac 100644 --- a/Sources/SqlDatabase/Scripts/Database.cs +++ b/Sources/SqlDatabase/Scripts/Database.cs @@ -2,28 +2,34 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using SqlDatabase.Adapter; +using SqlDatabase.Adapter.Sql; using SqlDatabase.Configuration; namespace SqlDatabase.Scripts; internal sealed class Database : IDatabase { - public Database() + public Database(IDatabaseAdapter adapter, ILogger log, TransactionMode transaction, bool whatIf) { + Adapter = adapter; + Log = log; + Transaction = transaction; + WhatIf = whatIf; Variables = new Variables(); } - public IDatabaseAdapter Adapter { get; set; } + public IDatabaseAdapter Adapter { get; } - public ILogger Log { get; set; } + public ILogger Log { get; } - public TransactionMode Transaction { get; set; } + public TransactionMode Transaction { get; internal set; } - public bool WhatIf { get; set; } + public bool WhatIf { get; internal set; } internal Variables Variables { get; } - public Version GetCurrentVersion(string moduleName) + public Version GetCurrentVersion(string? moduleName) { Variables.ModuleName = moduleName; @@ -45,7 +51,7 @@ public string GetServerVersion() command.CommandText = Adapter.GetServerVersionSelectScript(); connection.Open(); - return Convert.ToString(command.ExecuteScalar()); + return Convert.ToString(command.ExecuteScalar())!; } } @@ -111,16 +117,13 @@ private void WriteCurrentVersion(IDbCommand command, Version targetVersion) } catch (DbException ex) { - throw new InvalidOperationException("Fail to update the version, script: {0}".FormatWith(script), ex); + throw new InvalidOperationException($"Fail to update the version, script: {script}", ex); } var checkVersion = ReadCurrentVersion(command); if (checkVersion != targetVersion) { - throw new InvalidOperationException("Set version script works incorrectly: expected version is {0}, but actual is {1}. Script: {2}".FormatWith( - targetVersion, - checkVersion, - script)); + throw new InvalidOperationException($"Set version script works incorrectly: expected version is {targetVersion}, but actual is {checkVersion}. Script: {script}"); } } @@ -129,24 +132,24 @@ private Version ReadCurrentVersion(IDbCommand command) var script = new SqlScriptVariableParser(Variables).ApplyVariables(Adapter.GetVersionSelectScript()); command.CommandText = script; - string version; + string? version; try { version = Convert.ToString(command.ExecuteScalar()); } catch (DbException ex) { - throw new InvalidOperationException("Fail to read the version, script: {0}".FormatWith(script), ex); + throw new InvalidOperationException($"Fail to read the version, script: {script}", ex); } if (!Version.TryParse(version, out var result)) { if (string.IsNullOrEmpty(Variables.ModuleName)) { - throw new InvalidOperationException("The version [{0}] of database is invalid.".FormatWith(version)); + throw new InvalidOperationException($"The version [{version}] of database is invalid."); } - throw new InvalidOperationException("The version [{0}] of module [{1}] is invalid.".FormatWith(version, Variables.ModuleName)); + throw new InvalidOperationException($"The version [{version}] of module [{Variables.ModuleName}] is invalid."); } return result; @@ -183,7 +186,7 @@ private void InvokeExecute(IScript script) command.CommandTimeout = 0; connection.Open(); - command.CommandText = Adapter.GetDatabaseExistsScript(Variables.DatabaseName); + command.CommandText = Adapter.GetDatabaseExistsScript(Variables.DatabaseName!); var value = command.ExecuteScalar(); useMaster = value == null || Convert.IsDBNull(value); diff --git a/Sources/SqlDatabase/Scripts/DatabaseAdapterFactory.cs b/Sources/SqlDatabase/Scripts/DatabaseAdapterFactory.cs index c64f5aa8..9eaf2874 100644 --- a/Sources/SqlDatabase/Scripts/DatabaseAdapterFactory.cs +++ b/Sources/SqlDatabase/Scripts/DatabaseAdapterFactory.cs @@ -1,14 +1,9 @@ using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data.Common; -using System.Data.SqlClient; -using MySqlConnector; -using Npgsql; +using SqlDatabase.Adapter; +using SqlDatabase.Adapter.MsSql; +using SqlDatabase.Adapter.MySql; +using SqlDatabase.Adapter.PgSql; using SqlDatabase.Configuration; -using SqlDatabase.Scripts.MsSql; -using SqlDatabase.Scripts.MySql; -using SqlDatabase.Scripts.PgSql; namespace SqlDatabase.Scripts; @@ -17,83 +12,59 @@ internal static class DatabaseAdapterFactory public static IDatabaseAdapter CreateAdapter(string connectionString, AppConfiguration configuration, ILogger log) { // connection strings are compatible - var factories = new List>(3); + Func? factory = null; + var factoriesCounter = 0; - if (CanBe(connectionString, "Data Source", "Initial Catalog")) + if (MsSqlDatabaseAdapterFactory.CanBe(connectionString)) { - factories.Add(CreateMsSql); + factoriesCounter++; + factory = CreateMsSql; } - if (CanBe(connectionString, "Host", "Database")) + if (PgSqlDatabaseAdapterFactory.CanBe(connectionString)) { - factories.Add(CreatePgSql); + factoriesCounter++; + factory = CreatePgSql; } - if (CanBe(connectionString, "Server", "Database")) + if (MySqlDatabaseAdapterFactory.CanBe(connectionString)) { - factories.Add(CreateMySql); + factoriesCounter++; + factory = CreateMySql; } - if (factories.Count != 1) + if (factory == null || factoriesCounter != 1) { throw new ConfigurationErrorsException("Could not determine the database type from the provided connection string."); } - return factories[0](connectionString, configuration, log); + return factory(connectionString, configuration, log); } private static IDatabaseAdapter CreateMsSql(string connectionString, AppConfiguration configuration, ILogger log) { - return new MsSqlDatabaseAdapter(connectionString, configuration, log); - } - - private static IDatabaseAdapter CreatePgSql(string connectionString, AppConfiguration configuration, ILogger log) - { - return new PgSqlDatabaseAdapter(connectionString, configuration, log); - } - - private static IDatabaseAdapter CreateMySql(string connectionString, AppConfiguration configuration, ILogger log) - { - return new MySqlDatabaseAdapter(connectionString, configuration, log); - } - - private static bool CanBe(string connectionString, params string[] keywords) - where TBuilder : DbConnectionStringBuilder, new() - { - if (!Is(connectionString)) + var getCurrentVersionScript = configuration.MsSql.GetCurrentVersionScript; + if (string.IsNullOrWhiteSpace(getCurrentVersionScript)) { - return false; + getCurrentVersionScript = configuration.GetCurrentVersionScript; } - var test = new HashSet(keywords, StringComparer.OrdinalIgnoreCase); - - var pairs = connectionString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); - for (var i = 0; i < pairs.Length; i++) + var setCurrentVersionScript = configuration.MsSql.SetCurrentVersionScript; + if (string.IsNullOrWhiteSpace(setCurrentVersionScript)) { - var pair = pairs[i].Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries); - test.Remove(pair[0]); + setCurrentVersionScript = configuration.SetCurrentVersionScript; } - return test.Count == 0; + return MsSqlDatabaseAdapterFactory.CreateAdapter(connectionString, getCurrentVersionScript, setCurrentVersionScript, log); } - private static bool Is(string connectionString) - where TBuilder : DbConnectionStringBuilder, new() + private static IDatabaseAdapter CreatePgSql(string connectionString, AppConfiguration configuration, ILogger log) { - var builder = new TBuilder(); - - try - { - builder.ConnectionString = connectionString; - return true; - } - catch (ArgumentException) - { - } - catch (FormatException) - { - } + return PgSqlDatabaseAdapterFactory.CreateAdapter(connectionString, configuration.PgSql.GetCurrentVersionScript, configuration.PgSql.SetCurrentVersionScript, log); + } - return false; + private static IDatabaseAdapter CreateMySql(string connectionString, AppConfiguration configuration, ILogger log) + { + return MySqlDatabaseAdapterFactory.CreateAdapter(connectionString, configuration.MySql.GetCurrentVersionScript, configuration.MySql.SetCurrentVersionScript, log); } } \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/IDatabase.cs b/Sources/SqlDatabase/Scripts/IDatabase.cs index 0f75c7ed..6f9807fb 100644 --- a/Sources/SqlDatabase/Scripts/IDatabase.cs +++ b/Sources/SqlDatabase/Scripts/IDatabase.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Data; +using SqlDatabase.Adapter; namespace SqlDatabase.Scripts; @@ -10,7 +11,7 @@ internal interface IDatabase string GetServerVersion(); - Version GetCurrentVersion(string moduleName); + Version GetCurrentVersion(string? moduleName); void Execute(IScript script, string moduleName, Version currentVersion, Version targetVersion); diff --git a/Sources/SqlDatabase/Scripts/IPowerShellFactory.cs b/Sources/SqlDatabase/Scripts/IPowerShellFactory.cs deleted file mode 100644 index f68528f5..00000000 --- a/Sources/SqlDatabase/Scripts/IPowerShellFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -using SqlDatabase.Scripts.PowerShellInternal; - -namespace SqlDatabase.Scripts; - -internal interface IPowerShellFactory -{ - string InstallationPath { get; } - - void Request(); - - void InitializeIfRequested(ILogger logger); - - IPowerShell Create(); -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/IScriptFactory.cs b/Sources/SqlDatabase/Scripts/IScriptFactory.cs deleted file mode 100644 index a24eb2a1..00000000 --- a/Sources/SqlDatabase/Scripts/IScriptFactory.cs +++ /dev/null @@ -1,10 +0,0 @@ -using SqlDatabase.IO; - -namespace SqlDatabase.Scripts; - -public interface IScriptFactory -{ - bool IsSupported(string fileName); - - IScript FromFile(IFile file); -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/IScriptResolver.cs b/Sources/SqlDatabase/Scripts/IScriptResolver.cs new file mode 100644 index 00000000..65915cc9 --- /dev/null +++ b/Sources/SqlDatabase/Scripts/IScriptResolver.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; +using SqlDatabase.Adapter; + +namespace SqlDatabase.Scripts; + +internal interface IScriptResolver +{ + void InitializeEnvironment(ILogger logger, IEnumerable scripts); +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/IVariables.cs b/Sources/SqlDatabase/Scripts/IVariables.cs deleted file mode 100644 index f814e8e7..00000000 --- a/Sources/SqlDatabase/Scripts/IVariables.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SqlDatabase.Scripts; - -public interface IVariables -{ - string GetValue(string name); -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.hosted.cs b/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.hosted.cs deleted file mode 100644 index 4f79bae0..00000000 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.hosted.cs +++ /dev/null @@ -1,101 +0,0 @@ -#if NETCOREAPP || NET5_0_OR_GREATER -using System; -using System.IO; -using System.Management.Automation; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.Loader; -using SqlDatabase.Configuration; - -namespace SqlDatabase.Scripts.PowerShellInternal -{ - // https://github.com/PowerShell/PowerShell/tree/master/docs/host-powershell - internal partial class PowerShellFactory - { - partial void DoInitialize(ILogger logger) - { - if (string.IsNullOrEmpty(InstallationPath)) - { - if (InstallationSeeker.TryFindByParentProcess(out var test)) - { - InstallationPath = test; - } - else if (InstallationSeeker.TryFindOnDisk(out test)) - { - InstallationPath = test; - } - } - - if (string.IsNullOrEmpty(InstallationPath)) - { - throw new InvalidOperationException("PowerShell Core installation not found, please provide installation path via command line options {0}{1}.".FormatWith(Arg.Sign, Arg.UsePowerShell)); - } - - if (!InstallationSeeker.TryGetInfo(InstallationPath, out var info)) - { - throw new InvalidOperationException("PowerShell Core installation not found in {0}.".FormatWith(InstallationPath)); - } - - logger.Info("host PowerShell from {0}, version {1}".FormatWith(InstallationPath, info.ProductVersion)); - - AssemblyLoadContext.Default.Resolving += AssemblyResolving; - try - { - Test(logger); - } - catch (Exception ex) - { - throw new InvalidOperationException("PowerShell host initialization failed. Try to use another PowerShell Core installation.", ex); - } - finally - { - AssemblyLoadContext.Default.Resolving -= AssemblyResolving; - } - } - - private void Test(ILogger logger) - { - SetPowerShellAssemblyLoadContext(); - - using (logger.Indent()) - { - const string Script = @" -Write-Host ""PSVersion:"" $PSVersionTable.PSVersion -Write-Host ""PSEdition:"" $PSVersionTable.PSEdition -Write-Host ""OS:"" $PSVersionTable.OS"; - - Create().Invoke(Script, logger); - } - } - - private Assembly AssemblyResolving(AssemblyLoadContext context, AssemblyName assemblyName) - { - if (InstallationSeeker.RootAssemblyName.Equals(assemblyName.Name, StringComparison.OrdinalIgnoreCase)) - { - var fileName = Path.Combine(InstallationPath, InstallationSeeker.RootAssemblyFileName); - return context.LoadFromAssemblyPath(fileName); - } - - // https://github.com/PowerShell/PowerShell/releases/download/v7.0.5/powershell_7.0.5-1.debian.10_amd64.deb - // Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. - // package contains Microsoft.Management.Infrastructure, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null - if ("Microsoft.Management.Infrastructure".Equals(assemblyName.Name, StringComparison.OrdinalIgnoreCase)) - { - var fileName = Path.Combine(InstallationPath, assemblyName.Name + ".dll"); - if (File.Exists(fileName)) - { - return context.LoadFromAssemblyPath(fileName); - } - } - - return null; - } - - [MethodImpl(MethodImplOptions.NoInlining)] - private void SetPowerShellAssemblyLoadContext() - { - PowerShellAssemblyLoadContextInitializer.SetPowerShellAssemblyLoadContext(InstallationPath); - } - } -} -#endif \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.native.cs b/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.native.cs deleted file mode 100644 index b71e787b..00000000 --- a/Sources/SqlDatabase/Scripts/PowerShellInternal/PowerShellFactory.native.cs +++ /dev/null @@ -1,8 +0,0 @@ -#if NET452 || NETSTANDARD -namespace SqlDatabase.Scripts.PowerShellInternal -{ - internal partial class PowerShellFactory - { - } -} -#endif \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/ScriptFactory.cs b/Sources/SqlDatabase/Scripts/ScriptFactory.cs deleted file mode 100644 index 892f0455..00000000 --- a/Sources/SqlDatabase/Scripts/ScriptFactory.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using SqlDatabase.Configuration; -using SqlDatabase.IO; - -namespace SqlDatabase.Scripts; - -internal sealed class ScriptFactory : IScriptFactory -{ - public AssemblyScriptConfiguration AssemblyScriptConfiguration { get; set; } - - public IPowerShellFactory PowerShellFactory { get; set; } - - public ISqlTextReader TextReader { get; set; } - - public bool IsSupported(string fileName) - { - var ext = Path.GetExtension(fileName); - - return ".sql".Equals(ext, StringComparison.OrdinalIgnoreCase) - || ".exe".Equals(ext, StringComparison.OrdinalIgnoreCase) - || ".dll".Equals(ext, StringComparison.OrdinalIgnoreCase) - || (PowerShellFactory != null && ".ps1".Equals(ext, StringComparison.OrdinalIgnoreCase)); - } - - public IScript FromFile(IFile file) - { - var ext = Path.GetExtension(file.Name); - - if (".sql".Equals(ext, StringComparison.OrdinalIgnoreCase)) - { - return new TextScript - { - DisplayName = file.Name, - ReadSqlContent = file.OpenRead, - TextReader = TextReader - }; - } - - if (".exe".Equals(ext, StringComparison.OrdinalIgnoreCase) - || ".dll".Equals(ext, StringComparison.OrdinalIgnoreCase)) - { - return new AssemblyScript - { - DisplayName = file.Name, - Configuration = AssemblyScriptConfiguration, - ReadAssemblyContent = CreateBinaryReader(file), - ReadDescriptionContent = CreateScriptDescriptionReader(file) - }; - } - - if (".ps1".Equals(ext, StringComparison.OrdinalIgnoreCase)) - { - if (PowerShellFactory == null) - { - throw new NotSupportedException(".ps1 scripts are not supported in this context."); - } - - PowerShellFactory.Request(); - - return new PowerShellScript - { - DisplayName = file.Name, - ReadScriptContent = file.OpenRead, - ReadDescriptionContent = CreateScriptDescriptionReader(file), - PowerShellFactory = PowerShellFactory - }; - } - - throw new NotSupportedException("File [{0}] cannot be used as script.".FormatWith(file.Name)); - } - - private static Func CreateBinaryReader(IFile file) - { - return () => BinaryRead(file); - } - - private static Func CreateScriptDescriptionReader(IFile file) - { - return () => - { - var parent = file.GetParent(); - if (parent == null) - { - return null; - } - - var descriptionName = Path.GetFileNameWithoutExtension(file.Name) + ".txt"; - var description = parent.GetFiles().FirstOrDefault(i => string.Equals(descriptionName, i.Name, StringComparison.OrdinalIgnoreCase)); - - return description?.OpenRead(); - }; - } - - private static byte[] BinaryRead(IFile file) - { - using (var source = file.OpenRead()) - using (var dest = new MemoryStream()) - { - source.CopyTo(dest); - - return dest.ToArray(); - } - } -} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/ScriptResolver.cs b/Sources/SqlDatabase/Scripts/ScriptResolver.cs new file mode 100644 index 00000000..eb690796 --- /dev/null +++ b/Sources/SqlDatabase/Scripts/ScriptResolver.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using SqlDatabase.Adapter; +using SqlDatabase.FileSystem; + +namespace SqlDatabase.Scripts; + +internal sealed class ScriptResolver : IScriptResolver, IScriptFactory +{ + public ScriptResolver(IScriptFactory[] factories) + { + Factories = factories; + } + + public IScriptFactory[] Factories { get; } + + public bool IsSupported(IFile file) => FindSupported(file) != null; + + public IScript FromFile(IFile file) + { + var factory = FindSupported(file); + if (factory == null) + { + throw new NotSupportedException($"File [{file.Name}] cannot be used as script."); + } + + return factory.FromFile(file); + } + + public void InitializeEnvironment(ILogger logger, IEnumerable scripts) + { + var environments = new List(Factories.Length); + for (var i = 0; i < Factories.Length; i++) + { + if (Factories[i] is IScriptEnvironment env) + { + environments.Add(env); + } + } + + if (environments.Count == 0) + { + return; + } + + foreach (var script in scripts) + { + for (var i = 0; i < environments.Count; i++) + { + var env = environments[i]; + if (env.IsSupported(script)) + { + env.Initialize(logger); + environments.RemoveAt(i); + break; + } + } + + if (environments.Count == 0) + { + return; + } + } + } + + private IScriptFactory? FindSupported(IFile file) + { + for (var i = 0; i < Factories.Length; i++) + { + var result = Factories[i]; + if (result.IsSupported(file)) + { + return result; + } + } + + return null; + } +} \ No newline at end of file diff --git a/Sources/SqlDatabase/Scripts/Variables.cs b/Sources/SqlDatabase/Scripts/Variables.cs index 69621de0..a9826ff7 100644 --- a/Sources/SqlDatabase/Scripts/Variables.cs +++ b/Sources/SqlDatabase/Scripts/Variables.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using SqlDatabase.Adapter; namespace SqlDatabase.Scripts; @@ -7,7 +8,7 @@ internal sealed class Variables : IVariables { private readonly IDictionary _valueByName = new Dictionary(StringComparer.OrdinalIgnoreCase); - public string DatabaseName + public string? DatabaseName { get => GetValue(nameof(DatabaseName)); set @@ -17,19 +18,19 @@ public string DatabaseName } } - public string CurrentVersion + public string? CurrentVersion { get => GetValue(nameof(CurrentVersion)); set => SetValue(VariableSource.Runtime, nameof(CurrentVersion), value); } - public string TargetVersion + public string? TargetVersion { get => GetValue(nameof(TargetVersion)); set => SetValue(VariableSource.Runtime, nameof(TargetVersion), value); } - public string ModuleName + public string? ModuleName { get => GetValue(nameof(ModuleName)); set => SetValue(VariableSource.Runtime, nameof(ModuleName), value); @@ -40,7 +41,7 @@ public IEnumerable GetNames() return _valueByName.Keys; } - public string GetValue(string name) + public string? GetValue(string name) { if (_valueByName.TryGetValue(name, out var value)) { @@ -54,7 +55,7 @@ public string GetValue(string name) return string.IsNullOrEmpty(environmentValue) ? value.Value : environmentValue; } - internal void SetValue(VariableSource source, string name, string value) + internal void SetValue(VariableSource source, string name, string? value) { if (!_valueByName.TryGetValue(name, out var oldValue) || source <= oldValue.Source) @@ -82,14 +83,8 @@ public VariableValue(VariableSource source, string value) public string Value { get; } - public override bool Equals(object obj) - { - throw new NotSupportedException(); - } + public override bool Equals(object? obj) => throw new NotSupportedException(); - public override int GetHashCode() - { - throw new NotSupportedException(); - } + public override int GetHashCode() => throw new NotSupportedException(); } } \ No newline at end of file diff --git a/Sources/SqlDatabase/SqlDatabase.csproj b/Sources/SqlDatabase/SqlDatabase.csproj index 4ca88f4f..9a434fc5 100644 --- a/Sources/SqlDatabase/SqlDatabase.csproj +++ b/Sources/SqlDatabase/SqlDatabase.csproj @@ -1,93 +1,47 @@  - - net452;netcoreapp3.1;net5.0;net6.0;net7.0;netstandard2.0 - netcoreapp3.1;net5.0;net6.0;net7.0 - + net472;net6.0;net7.0;net8.0;netstandard2.0 + net6.0;net7.0;net8.0 - Exe ..\..\bin\SqlDatabase - - SqlDatabase SqlDatabase.GlobalTool - - Max Ieremenko - SqlDatabase is a tool for MSSQL Server, PostgreSQL and MySQL, allows executing scripts, database migrations and data export. - https://github.com/max-ieremenko/SqlDatabase/releases - https://github.com/max-ieremenko/SqlDatabase - https://github.com/max-ieremenko/SqlDatabase - https://github.com/max-ieremenko/SqlDatabase/raw/master/icon-32.png - icon-32.png - MIT - (C) 2018-2022 Max Ieremenko. - git - sqlserver database postgresql mysql mysql-database sqlcmd migration-tool c-sharp command-line-tool miration-step sql-script sql-database database-migrations export-data - + + + + + + + + + + + + - - - - - + + + + + - + - - - - - - ..\Dependencies\System.Management.Automation.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Sources/SqlDatabase/StringExtensions.cs b/Sources/SqlDatabase/StringExtensions.cs deleted file mode 100644 index e5d98b5b..00000000 --- a/Sources/SqlDatabase/StringExtensions.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Globalization; - -namespace SqlDatabase; - -internal static class StringExtensions -{ - public static string FormatWith(this string format, params object[] args) - { - return string.Format(CultureInfo.InvariantCulture, format, args); - } -} \ No newline at end of file diff --git a/Sources/global.json b/Sources/global.json new file mode 100644 index 00000000..5815c394 --- /dev/null +++ b/Sources/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "8.0.100-rc.2.23502.2", + "allowPrerelease": true, + "rollForward": "latestFeature" + } +} \ No newline at end of file diff --git a/Sources/nuget.config b/Sources/nuget.config new file mode 100644 index 00000000..167b985e --- /dev/null +++ b/Sources/nuget.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file