@@ -764,7 +764,7 @@ internal static Version GetAssemblyVersion()
764
764
765
765
internal static bool IsAzureSynapseOnDemandEndpoint ( string dataSource )
766
766
{
767
- return IsEndpoint ( dataSource , ONDEMAND_PREFIX )
767
+ return IsEndpoint ( dataSource , s_azureSqlServerOnDemandEndpoints )
768
768
|| dataSource . Contains ( AZURE_SYNAPSE )
769
769
|| dataSource . Contains ( FABRIC_DATAWAREHOUSE )
770
770
|| dataSource . Contains ( PBI_DATAWAREHOUSE )
@@ -777,14 +777,20 @@ internal static bool IsAzureSynapseOnDemandEndpoint(string dataSource)
777
777
AZURE_SQL_USGOV ,
778
778
AZURE_SQL_CHINA ,
779
779
AZURE_SQL_FABRIC } ;
780
+
781
+ internal static readonly string [ ] s_azureSqlServerOnDemandEndpoints = { ONDEMAND_PREFIX + AZURE_SQL ,
782
+ ONDEMAND_PREFIX + AZURE_SQL_GERMANY ,
783
+ ONDEMAND_PREFIX + AZURE_SQL_USGOV ,
784
+ ONDEMAND_PREFIX + AZURE_SQL_CHINA ,
785
+ ONDEMAND_PREFIX + AZURE_SQL_FABRIC } ;
780
786
781
787
internal static bool IsAzureSqlServerEndpoint ( string dataSource )
782
788
{
783
- return IsEndpoint ( dataSource , null ) ;
789
+ return IsEndpoint ( dataSource , s_azureSqlServerEndpoints ) ;
784
790
}
785
791
786
792
// This method assumes dataSource parameter is in TCP connection string format.
787
- private static bool IsEndpoint ( string dataSource , string prefix )
793
+ private static bool IsEndpoint ( string dataSource , string [ ] endpoints )
788
794
{
789
795
int length = dataSource . Length ;
790
796
// remove server port
@@ -805,8 +811,6 @@ private static bool IsEndpoint(string dataSource, string prefix)
805
811
foundIndex = - 1 ;
806
812
}
807
813
808
-
809
-
810
814
if ( foundIndex > 0 )
811
815
{
812
816
length = foundIndex ;
@@ -819,9 +823,9 @@ private static bool IsEndpoint(string dataSource, string prefix)
819
823
}
820
824
821
825
// check if servername ends with any endpoints
822
- for ( int index = 0 ; index < s_azureSqlServerEndpoints . Length ; index ++ )
826
+ for ( int index = 0 ; index < endpoints . Length ; index ++ )
823
827
{
824
- string endpoint = string . IsNullOrEmpty ( prefix ) ? s_azureSqlServerEndpoints [ index ] : prefix + s_azureSqlServerEndpoints [ index ] ;
828
+ string endpoint = endpoints [ index ] ;
825
829
if ( length > endpoint . Length )
826
830
{
827
831
if ( string . Compare ( dataSource , length - endpoint . Length , endpoint , 0 , endpoint . Length , StringComparison . OrdinalIgnoreCase ) == 0 )
0 commit comments