Skip to content

Commit e848450

Browse files
authored
Move into Shared for SqlConnectionString.cs (#1329)
1 parent 9fd88b1 commit e848450

File tree

8 files changed

+488
-1358
lines changed

8 files changed

+488
-1358
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@
265265
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs">
266266
<Link>Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs</Link>
267267
</Compile>
268+
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionString.cs">
269+
<Link>Microsoft\Data\SqlClient\SqlConnectionString.cs</Link>
270+
</Compile>
268271
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlCredential.cs">
269272
<Link>Microsoft\Data\SqlClient\SqlCredential.cs</Link>
270273
</Compile>
@@ -496,7 +499,6 @@
496499
<ItemGroup Condition="'$(OSGroup)' != 'AnyOS' AND '$(TargetGroup)' == 'netcoreapp'">
497500
<Compile Include="Microsoft\Data\ProviderBase\DbConnectionPool.NetCoreApp.cs" />
498501
<Compile Include="Microsoft\Data\SqlClient\SqlAuthenticationProviderManager.NetCoreApp.cs" />
499-
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionString.NetCoreApp.cs" />
500502
<Compile Include="Microsoft\Data\SqlClient\SqlDiagnosticListener.NetCoreApp.cs" />
501503
<Compile Include="Microsoft\Data\SqlClient\SqlDelegatedTransaction.NetCoreApp.cs" />
502504
<Compile Include="Microsoft\Data\SqlClient\TdsParser.NetCoreApp.cs" />
@@ -564,7 +566,6 @@
564566
<Compile Include="Microsoft\Data\SqlClient\SqlConnection.cs" />
565567
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionFactory.cs" />
566568
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionHelper.cs" />
567-
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionString.cs" />
568569
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs">
569570
<Link>Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs</Link>
570571
</Compile>

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionString.NetCoreApp.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

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

Lines changed: 0 additions & 941 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@
351351
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs">
352352
<Link>Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs</Link>
353353
</Compile>
354+
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionString.cs">
355+
<Link>Microsoft\Data\SqlClient\SqlConnectionString.cs</Link>
356+
</Compile>
354357
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlDataAdapter.cs">
355358
<Link>Microsoft\Data\SqlClient\SqlDataAdapter.cs</Link>
356359
</Compile>
@@ -554,7 +557,6 @@
554557
<Compile Include="Microsoft\Data\SqlClient\SqlConnection.cs" />
555558
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionFactory.cs" />
556559
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionHelper.cs" />
557-
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionString.cs" />
558560
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs">
559561
<Link>Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs</Link>
560562
</Compile>

src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/DbConnectionStringCommon.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ internal static class DbConnectionStringDefaults
952952
internal const bool ContextConnection = false;
953953
internal static readonly bool TransparentNetworkIPResolution = !LocalAppContextSwitches.DisableTNIRByDefault;
954954
internal const string NetworkLibrary = "";
955+
internal const bool Asynchronous = false;
955956
#if ADONET_CERT_AUTH
956957
internal const string Certificate = "";
957958
#endif
@@ -982,7 +983,7 @@ internal static class DbConnectionStringDefaults
982983
internal const int ConnectRetryCount = 1;
983984
internal const int ConnectRetryInterval = 10;
984985
internal static readonly SqlAuthenticationMethod Authentication = SqlAuthenticationMethod.NotSpecified;
985-
internal static readonly SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Disabled;
986+
internal const SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Disabled;
986987
internal const string EnclaveAttestationUrl = "";
987988
internal const SqlConnectionAttestationProtocol AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified;
988989
internal const SqlConnectionIPAddressPreference IPAddressPreference = SqlConnectionIPAddressPreference.IPv4First;
Lines changed: 458 additions & 378 deletions
Large diffs are not rendered by default.

src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void Constructor2_ConnectionString_Invalid()
8686
// Keyword not supported: 'invalidkeyword'
8787
Assert.Null(ex.InnerException);
8888
Assert.NotNull(ex.Message);
89-
Assert.True(ex.Message.IndexOf("'invalidkeyword'") != -1);
89+
Assert.True(ex.Message.IndexOf("'invalidkeyword'", StringComparison.OrdinalIgnoreCase) != -1);
9090
Assert.Null(ex.ParamName);
9191

9292
// invalid packet size (< minimum)
@@ -267,7 +267,7 @@ public void ConnectionString_Value_Invalid()
267267
// Keyword not supported: 'invalidkeyword'
268268
Assert.Null(ex.InnerException);
269269
Assert.NotNull(ex.Message);
270-
Assert.True(ex.Message.IndexOf("'invalidkeyword'") != -1);
270+
Assert.True(ex.Message.IndexOf("'invalidkeyword'", StringComparison.OrdinalIgnoreCase) != -1);
271271
Assert.Null(ex.ParamName);
272272
}
273273

@@ -468,7 +468,7 @@ public void ConnectionString_ConnectTimeout_Invalid()
468468
// Invalid value for key 'connect timeout'
469469
Assert.Null(ex.InnerException);
470470
Assert.NotNull(ex.Message);
471-
Assert.True(ex.Message.IndexOf("'connect timeout'") != -1);
471+
Assert.True(ex.Message.IndexOf("'connect timeout'", StringComparison.OrdinalIgnoreCase) != -1);
472472
Assert.Null(ex.ParamName);
473473

474474
// invalid number
@@ -477,7 +477,7 @@ public void ConnectionString_ConnectTimeout_Invalid()
477477
Assert.NotNull(ex.InnerException);
478478
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
479479
Assert.NotNull(ex.Message);
480-
Assert.True(ex.Message.IndexOf("'connect timeout'") != -13);
480+
Assert.True(ex.Message.IndexOf("'connect timeout'", StringComparison.OrdinalIgnoreCase) != -1);
481481
Assert.Null(ex.ParamName);
482482

483483
// Input string was not in a correct format
@@ -491,7 +491,7 @@ public void ConnectionString_ConnectTimeout_Invalid()
491491
Assert.NotNull(ex.InnerException);
492492
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
493493
Assert.NotNull(ex.Message);
494-
Assert.True(ex.Message.IndexOf("'connect timeout'") != -1);
494+
Assert.True(ex.Message.IndexOf("'connect timeout'", StringComparison.OrdinalIgnoreCase) != -1);
495495
Assert.Null(ex.ParamName);
496496

497497
// Value was either too large or too small for an Int32
@@ -526,7 +526,7 @@ public void ConnectionString_CommandTimeout_Invalid()
526526
// Invalid value for key 'connect timeout'
527527
Assert.Null(ex.InnerException);
528528
Assert.NotNull(ex.Message);
529-
Assert.True(ex.Message.IndexOf("'command timeout'") != -1);
529+
Assert.True(ex.Message.IndexOf("'command timeout'", StringComparison.OrdinalIgnoreCase) != -1);
530530
Assert.Null(ex.ParamName);
531531

532532
// invalid number
@@ -535,7 +535,7 @@ public void ConnectionString_CommandTimeout_Invalid()
535535
Assert.NotNull(ex.InnerException);
536536
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
537537
Assert.NotNull(ex.Message);
538-
Assert.True(ex.Message.IndexOf("'command timeout'") != -13);
538+
Assert.True(ex.Message.IndexOf("'command timeout'", StringComparison.OrdinalIgnoreCase) != -1);
539539
Assert.Null(ex.ParamName);
540540

541541
// Input string was not in a correct format
@@ -549,7 +549,7 @@ public void ConnectionString_CommandTimeout_Invalid()
549549
Assert.NotNull(ex.InnerException);
550550
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
551551
Assert.NotNull(ex.Message);
552-
Assert.True(ex.Message.IndexOf("'command timeout'") != -1);
552+
Assert.True(ex.Message.IndexOf("'command timeout'", StringComparison.OrdinalIgnoreCase) != -1);
553553
Assert.Null(ex.ParamName);
554554

555555
// Value was either too large or too small for an Int32
@@ -634,7 +634,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
634634
// Invalid value for key 'max pool size'
635635
Assert.Null(ex.InnerException);
636636
Assert.NotNull(ex.Message);
637-
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
637+
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
638638
Assert.Null(ex.ParamName);
639639

640640
// invalid number
@@ -643,7 +643,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
643643
Assert.NotNull(ex.InnerException);
644644
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
645645
Assert.NotNull(ex.Message);
646-
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
646+
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
647647
Assert.Null(ex.ParamName);
648648

649649
// Input string was not in a correct format
@@ -657,7 +657,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
657657
Assert.NotNull(ex.InnerException);
658658
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
659659
Assert.NotNull(ex.Message);
660-
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
660+
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
661661
Assert.Null(ex.ParamName);
662662

663663
// Value was either too large or too small for an Int32
@@ -670,7 +670,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
670670
// Invalid value for key 'max pool size'
671671
Assert.Null(ex.InnerException);
672672
Assert.NotNull(ex.Message);
673-
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
673+
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
674674
Assert.Null(ex.ParamName);
675675

676676
// less than min pool size
@@ -702,7 +702,7 @@ public void ConnectionString_MinPoolSize_Invalid()
702702
// Invalid value for key 'min pool size'
703703
Assert.Null(ex.InnerException);
704704
Assert.NotNull(ex.Message);
705-
Assert.True(ex.Message.IndexOf("'min pool size'") != -1);
705+
Assert.True(ex.Message.IndexOf("'min pool size'", StringComparison.OrdinalIgnoreCase) != -1);
706706
Assert.Null(ex.ParamName);
707707

708708
// invalid number
@@ -711,7 +711,7 @@ public void ConnectionString_MinPoolSize_Invalid()
711711
Assert.NotNull(ex.InnerException);
712712
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
713713
Assert.NotNull(ex.Message);
714-
Assert.True(ex.Message.IndexOf("'min pool size'") != -1);
714+
Assert.True(ex.Message.IndexOf("'min pool size'", StringComparison.OrdinalIgnoreCase) != -1);
715715
Assert.Null(ex.ParamName);
716716

717717
// Input string was not in a correct format
@@ -725,7 +725,7 @@ public void ConnectionString_MinPoolSize_Invalid()
725725
Assert.NotNull(ex.InnerException);
726726
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
727727
Assert.NotNull(ex.Message);
728-
Assert.True(ex.Message.IndexOf("'min pool size'") != -1);
728+
Assert.True(ex.Message.IndexOf("'min pool size'", StringComparison.OrdinalIgnoreCase) != -1);
729729
Assert.Null(ex.ParamName);
730730

731731
// Value was either too large or too small for an Int32
@@ -750,7 +750,7 @@ public void ConnectionString_MultipleActiveResultSets_Invalid()
750750
// Invalid value for key 'multiple active result sets'
751751
Assert.Null(ex.InnerException);
752752
Assert.NotNull(ex.Message);
753-
Assert.True(ex.Message.IndexOf("'multiple active result sets'") != -1);
753+
Assert.True(ex.Message.IndexOf("'multiple active result sets'", StringComparison.OrdinalIgnoreCase) != -1);
754754
Assert.Null(ex.ParamName);
755755
}
756756

@@ -781,7 +781,7 @@ public void ConnectionString_PacketSize_Invalid()
781781
// integer >= 512 and <= 32768
782782
Assert.Null(ex.InnerException);
783783
Assert.NotNull(ex.Message);
784-
Assert.True(ex.Message.IndexOf("'Packet Size'") != -1);
784+
Assert.True(ex.Message.IndexOf("'Packet Size'", StringComparison.OrdinalIgnoreCase) != -1);
785785
Assert.Null(ex.ParamName);
786786

787787
// invalid packet size (> maximum)
@@ -790,7 +790,7 @@ public void ConnectionString_PacketSize_Invalid()
790790
// integer >= 512 and <= 32768
791791
Assert.Null(ex.InnerException);
792792
Assert.NotNull(ex.Message);
793-
Assert.True(ex.Message.IndexOf("'Packet Size'") != -1);
793+
Assert.True(ex.Message.IndexOf("'Packet Size'", StringComparison.OrdinalIgnoreCase) != -1);
794794
Assert.Null(ex.ParamName);
795795

796796
// overflow
@@ -799,7 +799,7 @@ public void ConnectionString_PacketSize_Invalid()
799799
Assert.NotNull(ex.InnerException);
800800
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
801801
Assert.NotNull(ex.Message);
802-
Assert.True(ex.Message.IndexOf("'packet size'") != -1);
802+
Assert.True(ex.Message.IndexOf("'packet size'", StringComparison.OrdinalIgnoreCase) != -1);
803803
Assert.Null(ex.ParamName);
804804

805805
// Value was either too large or too small for an Int32
@@ -849,7 +849,7 @@ public void ConnectionString_UserInstance_Invalid()
849849
// Invalid value for key 'user instance'
850850
Assert.Null(ex.InnerException);
851851
Assert.NotNull(ex.Message);
852-
Assert.True(ex.Message.IndexOf("'user instance'") != -1);
852+
Assert.True(ex.Message.IndexOf("'user instance'", StringComparison.OrdinalIgnoreCase) != -1);
853853
Assert.Null(ex.ParamName);
854854
}
855855

@@ -1009,7 +1009,7 @@ public void ConnectionString_IPAddressPreference_Invalid(string value)
10091009
// Invalid value for key 'ip address preference'
10101010
Assert.Null(ex.InnerException);
10111011
Assert.NotNull(ex.Message);
1012-
Assert.Contains("'ip address preference'", ex.Message);
1012+
Assert.Contains("'ip address preference'", ex.Message, StringComparison.OrdinalIgnoreCase);
10131013
Assert.Null(ex.ParamName);
10141014
}
10151015
}

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public static void InvalidAuthTypeTest()
186186
ArgumentException e = Assert.Throws<ArgumentException>(() => ConnectAndDisconnect(connStr));
187187

188188
string expectedMessage = "Invalid value for key 'authentication'.";
189-
Assert.Contains(expectedMessage, e.Message);
189+
Assert.Contains(expectedMessage, e.Message, StringComparison.OrdinalIgnoreCase);
190190
}
191191

192192
[ConditionalFact(nameof(IsAADConnStringsSetup))]

0 commit comments

Comments
 (0)