8000 Merge main · dotnet/SqlClient@59da4d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 59da4d6

Browse files
committed
Merge main
2 parents 43ecf2c + ae02b60 commit 59da4d6

File tree

133 files changed

+6008
-5307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+6008
-5307
lines changed

BUILDGUIDE.md

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,118 @@ dotnet test <test_properties...> --collect:"XPlat Code Coverage"
339339

340340
## Run Performance Tests
341341

342-
### Running Performance test project directly
342+
The performance tests live here:
343+
`src\Microsoft.Data.SqlClient\tests\PerformanceTests\`
343344

344-
Project location from Root: `src\Microsoft.Data.SqlClient\tests\PerformanceTests\Microsoft.Data.SqlClient.PerformanceTests.csproj`
345-
Configure `runnerconfig.json` file with connection string and preferred settings to run Benchmark Jobs.
345+
They can be run from the command line by following the instructions below.
346+
347+
Launch a shell and change into the project directory:
348+
349+
PowerShell:
350+
351+
```pwsh
352+
> cd src\Microsoft.Data.SqlClient\tests\PerformanceTests
353+
```
354+
355+
Bash:
356+
357+
```bash
358+
$ cd src/Microsoft.Data.SqlClient/tests/PerformanceTests
359+
```
360+
361+
### Create Database
362+
363+
Create an empty database for the benchmarks to use. This example assumes
364+
a local SQL server instance using SQL authentication:
346365

347366
```bash
348-
cd src\Microsoft.Data.SqlClient\tests\PerformanceTests
349-
dotnet run -c Release -f net8.0
367+
$ sqlcmd -S localhost -U sa -P password
368+
1> create database [sqlclient-perf-db]
369+
2> go
370+
1> quit
371+
```
372+
373+
The default `runnerconfig.json` expects a database named `sqlclient-perf-db`,
374+
but you may change the config to use any existing database. All tables in
375+
the database will be dropped when running the benchmarks.
376+
377+
### Configure Runner
378+
379+
Configure the benchmarks by editing the `runnerconfig.json` file directly in the
380+
`PerformanceTests` directory with an appropriate connection string and benchmark
381+
settings:
382+
383+
```json
384+
{
385+
"ConnectionString": "Server=tcp:localhost; Integrated Security=true; Initial Catalog=sqlclient-perf-db;",
386+
"UseManagedSniOnWindows": false,
387+
"Benchmarks":
388+
{
389+
"SqlConnectionRunnerConfig":
390+
{
391+
"Enabled": true,
392+
"LaunchCount": 1,
393+
"IterationCount": 50,
394+
"InvocationCount":30,
395+
"WarmupCount": 5,
396+
"RowCount": 0
397+
},
398+
...
399+
}
400+
}
350401
```
351402

352-
_Only "**Release** Configuration" applies to Performance Tests_
403+
Individual benchmarks may be enabled or disabled, and each has several
404+
benchmarking options for fine tuning.
405+
406+
After making edits to `runnerconfig.json` you must perform a build which will
407+
copy the file into the `artifacts` directory alongside the benchmark DLL. By
408+
default, the benchmarks look for `runnerconfig.json` in the same directory as
409+
the DLL.
410+
411+
Optionally, to avoid polluting your git workspace and requring a build after
412+
each config change, copy `runnerconfig.json` to a new file, make your edits
413+
there, and then specify the new file with the RUNNER_CONFIG environment
414+
variable.
415+
416+
PowerShell:
417+
418+
```pwsh
419+
> copy runnerconfig.json $HOME\.configs\runnerconfig.json
420+
421+
# Make edits to $HOME\.configs\runnerconfig.json
422+
423+
# You must set the RUNNER_CONFIG environment variable for the current shell.
424+
> $env:RUNNER_CONFIG="${HOME}\.configs\runnerconfig.json"
425+
```
426+
427+
Bash:
428+
429+
```bash
430+
$ cp runnerconfig.json ~/.configs/runnerconfig.json
431+
432+
# Make edits to ~/.configs/runnerconfig.json
433+
434+
# Optionally export RUNNER_CONFIG.
435+
$ export RUNNER_CONFIG=~/.configs/runnerconfig.json
436+
```
437+
438+
### Run Benchmarks
439+
440+
All benchmarks must be compiled and run in **Release** configuration.
441+
442+
PowerShell:
443+
444+
```pwsh
445< BD94 span class="diff-text-marker">+
> dotnet run -c Release -f net9.0
446+
```
447+
448+
Bash:
449+
450+
```bash
451+
# Omit RUNNER_CONFIG if you exported it earlier, or if you're using the
452+
# copy prepared by the build.
453+
$ dotnet run -c Release -f net9.0
454+
455+
$ RUNNER_CONFIG=~/.configs/runnerconfig.json dotnet run -c Release -f net9.0
456+
```

build.proj

Lines changed: 98 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,21 +178,109 @@
178178
</Target>
179179

180180
<!-- Tests -->
181+
182+
<!-- Run all unit tests applicable to the host OS. -->
181183
<Target Name="RunTests" DependsOnTargets="RunFunctionalTests;RunManualTests"/>
182-
<Target Name="RunFunctionalTests">
183-
<!-- Windows -->
184-
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(FunctionalTestsProj)&quot; -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -v n --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter &quot;category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests&quot; &quot;--logger:trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' == 'true'"/>
185-
<!-- Unix -->
186-
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(FunctionalTestsProj)&quot; -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -v n -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --collect &quot;Code coverage&quot; --filter &quot;category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests&quot; &quot;--logger:trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' != 'true'"/>
184+
185+
<!-- Run all Functional tests applicable to the host OS. -->
186+
<Target Name="RunFunctionalTests" DependsOnTargets="RunFunctionalTestsWindows;RunFunctionalTestsUnix"/>
187+
188+
<!-- Run all Functional tests applicable to Windows. -->
189+
<Target Name="RunFunctionalTestsWindows" Condition="'$(IsEnabledWindows)' == 'true'">
190+
<PropertyGroup>
191+
<TestCommand>
192+
$(DotnetPath)dotnet test "@(FunctionalTestsProj)"
193+
--no-build
194+
-v n
195+
-p:Configuration=$(Configuration)
196+
-p:Target$(TFGroup)Version=$(TF)
197+
-p:ReferenceType=$(ReferenceType)
198+
-p:TestSet=$(TestSet)
199+
-p:TestTargetOS=Windows$(TargetGroup)
200+
--collect "Code coverage"
201+
--results-directory $(ResultsDirectory)
202+
--filter "category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests"
203+
--logger:"trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)"
204+
</TestCommand>
205+
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
206+
</PropertyGroup>
207+
<Message Text=">>> Running Functional test for Windows via command: $(TestCommand)"/>
208+
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
209+
</Target>
210+
211+
<!-- Run all Functional tests applicable to Unix. -->
212+
<Target Name="RunFunctionalTestsUnix" Condition="'$(IsEnabledWindows)' != 'true'">
213+
<PropertyGroup>
214+
<TestCommand>
215+
$(DotnetPath)dotnet test "@(FunctionalTestsProj)"
216+
--no-build
217+
-v n
218+
-p:Configuration=$(Configuration)
219+
-p:TargetNetCoreVersion=$(TF)
220+
-p:ReferenceType=$(ReferenceType)
221+
-p:TestSet=$(TestSet)
222+
-p:TestTargetOS=Unixnetcoreapp
223+
--collect "Code coverage"
224+
--results-directory $(ResultsDirectory)
225+
--filter "category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests"
226+
--logger:"trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)"
227+
</TestCommand>
228+
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
229+
</PropertyGroup>
230+
<Message Text=">>> Running Functional test for Unix via command: $(TestCommand)"/>
231+
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
232+
</Target>
233+
234+
<!-- Run all Manual tests applicable to the host OS. -->
235+
<Target Name="RunManualTests" DependsOnTargets="RunManualTestsWindows;RunManualTestsUnix"/>
236+
237+
<!-- Run all Manual tests applicable to Windows. -->
238+
<Target Name="RunManualTestsWindows" Condition="'$(IsEnabledWindows)' == 'true'">
239+
<PropertyGroup>
240+
<TestCommand>
241+
$(DotnetPath)dotnet test "@(ManualTestsProj)"
242+
--no-build
243+
-v n
244+
-p:Configuration=$(Configuration)
245+
-p:Target$(TFGroup)Version=$(TF)
246+
-p:ReferenceType=$(ReferenceType)
247+
-p:TestSet=$(TestSet)
248+
-p:TestTargetOS=Windows$(TargetGroup)
249+
--collect "Code coverage"
250+
--results-directory $(ResultsDirectory)
251+
--filter "category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests"
252+
--logger:"trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)"
253+
</TestCommand>
254+
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
255+
</PropertyGroup>
256+
<Message Text=">>> Running Manual test for Windows via command: $(TestCommand)"/>
257+
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
187258
</Target>
188259

189-
<Target Name="RunManualTests">
190-
<!-- Windows -->
191-
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter &quot;category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' == 'true'"/>
192-
<!-- Unix -->
193-
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --filter &quot;category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' != 'true'"/>
260+
<!-- Run all Manual tests applicable to Unix. -->
261+
<Target Name="RunManualTestsUnix" Condition="'$(IsEnabledWindows)' != 'true'">
262+
<PropertyGroup>
263+
<TestCommand>
264+
$(DotnetPath)dotnet test "@(ManualTestsProj)"
265+
--no-build
266+
-v n
267+
-p:Configuration=$(Configuration)
268+
-p:TargetNetCoreVersion=$(TF)
269+
-p:ReferenceType=$(ReferenceType)
270+
-p:TestSet=$(TestSet)
271+
-p:TestTargetOS=Unixnetcoreapp
272+
--collect "Code coverage"
273+
--results-directory $(ResultsDirectory)
274+
--filter "category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests"
275+
--logger:"trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)"
276+
</TestCommand>
277+
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
278+
</PropertyGroup>
279+
<Message Text=">>> Running Manual test for Unix via command: $(TestCommand)"/>
280+
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
194281
</Target>
195282

283+
<!-- Clean -->
196284
<Target Name="Clean">
197285
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","artifacts", SearchOption.AllDirectories))' />
198286
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","bin", SearchOption.AllDirectories))' />

doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
<remarks>
181181
The supported authentication modes with <see cref="T:Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider" /> are:
182182
<list type="bullet">
183-
<item>Active Directory Password</item>
183+
<item>Active Directory Password (deprecated)</item>
184184
<item>Active Directory Integrated</item>
185185
<item>Active Directory Interactive</item>
186186
<item>Active Directory Service Principal</item>

doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<value>1</value>
1313
</SqlPassword>
1414
<ActiveDirectoryPassword>
15-
<summary>The authentication method uses Active Directory Password. Use Active Directory Password to connect to a SQL Database using a Microsoft Entra principal name and password.</summary>
15+
<summary>The authentication method uses Active Directory Password. Use Active Directory Password to connect to a SQL Database using a Microsoft Entra principal name and password. This authentication method is now deprecated, and will be removed in a future release.</summary>
1616
<value>2</value>
1717
</ActiveDirectoryPassword>
1818
<ActiveDirectoryIntegrated>

doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,9 +1330,9 @@
13301330
Valid values are:
13311331
</para>
13321332
<list type="bullet">
1333+
<item><c>Active Directory Password (deprecated)</c></item>
13331334
<item><c>Active Directory Integrated</c></item>
13341335
<item><c>Active Directory Interactive</c></item>
1335-
<item><c>Active Directory Password</c></item>
13361336
<item><c>Active Directory Service Principal</c></item>
13371337
<item><c>Active Directory Device Code Flow</c></item>
13381338
<item><c>Active Directory Managed Identity</c></item>
@@ -1872,9 +1872,10 @@
18721872
<item>.database.usgovcloudapi.net</item>
18731873
<item>.database.cloudapi.de</item>
18741874
<item>.database.windows.net</item>
1875+
<item>.database.fabric.microsoft.com</item>
18751876
</list>
18761877
</item>
1877-
<item><c>Authentication</c> is 'Active Directory Password' or 'Active Directory Integrated'</item>
1878+
<item><c>Authentication</c> is one of the 'Active Directory' authentication types.</item>
18781879
</list>
18791880
</item>
18801881
<item><c>true</c> in all other cases.</item>

doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,10 +1638,11 @@
16381638
<item>.database.usgovcloudapi.net</item>
16391639
<item>.database.cloudapi.de</item>
16401640
<item>.database.windows.net</item>
1641+
<item>.database.fabric.microsoft.com</item>
16411642
</list>
16421643
</item>
16431644
<item>
1644-
<c>Authentication</c> is 'Active Directory Password' or 'Active Directory Integrated'
1645+
<c>Authentication</c> is one of the 'Active Directory' authentication types.
16451646
</item>
16461647
<item>Otherwise it defaults to <c>true</c>.</item>
16471648
</list>

eng/pipelines/common/templates/steps/pre-build-step.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ steps:
2929
displayName: 'Start SQLBrowser'
3030

3131
- task: NuGetToolInstaller@1
32-
displayName: 'Use NuGet '
32+
displayName: 'Use NuGet'

eng/pipelines/common/templates/steps/update-config-file-step.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ parameters:
126126

127127
steps:
128128
# All properties should be added here, and this template should be used for any manipulation of the config.json file.
129-
- powershell: |
129+
- pwsh: |
130130
$jdata = Get-Content -Raw "config.default.json" | ConvertFrom-Json
131131
foreach ($p in $jdata)
132132
{
@@ -186,7 +186,7 @@ steps:
186186
displayName: 'Update config.json'
187187

188188
- ${{ if eq(parameters.debug, true) }}:
189-
- powershell: |
189+
- pwsh: |
190190
$jdata = Get-Content -Raw "config.json" | ConvertFrom-Json
191191
foreach ($p in $jdata)
192192
{

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ public enum SqlAuthenticationMethod
190190
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/SqlPassword/*'/>
191191
SqlPassword = 1,
192192
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/ActiveDirectoryPassword/*'/>
193+
[System.Obsolete("ActiveDirectoryPassword is deprecated.")]
193194
ActiveDirectoryPassword = 2,
194195
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/ActiveDirectoryIntegrated/*'/>
195196
ActiveDirectoryIntegrated = 3,

0 commit comments

Comments
 (0)
0