|
24 | 24 | using Microsoft.Identity.Client; |
25 | 25 | using Microsoft.SqlServer.Server; |
26 | 26 | using System.Security.Authentication; |
27 | | -using System.Linq; |
28 | | - |
29 | 27 |
|
30 | 28 | #if NETFRAMEWORK |
31 | 29 | using System.Reflection; |
@@ -791,18 +789,17 @@ internal static Version GetAssemblyVersion() |
791 | 789 | /// </summary> |
792 | 790 | /// <remarks>This array contains predefined endpoint strings used to identify Azure Synapse and |
793 | 791 | /// associated services, such as Fabric Data Warehouse and Power BI Data Warehouse.</remarks> |
794 | | - internal static readonly string[] s_azureSynapseEndpoints = { AZURE_SYNAPSE, |
795 | | - FABRIC_DATAWAREHOUSE, |
| 792 | + internal static readonly string[] s_azureSynapseEndpoints = { FABRIC_DATAWAREHOUSE, |
796 | 793 | PBI_DATAWAREHOUSE, |
797 | 794 | PBI_DATAWAREHOUSE2, |
798 | 795 | PBI_DATAWAREHOUSE3 }; |
799 | 796 |
|
800 | | - internal static readonly string[] s_azureSynapseOnDemandEndpoints = s_azureSqlServerOnDemandEndpoints |
801 | | - .Concat(s_azureSynapseEndpoints) |
802 | | - .ToArray(); |
| 797 | + internal static readonly string[] s_azureSynapseOnDemandEndpoints = [.. s_azureSqlServerOnDemandEndpoints, .. s_azureSynapseEndpoints]; |
| 798 | + |
803 | 799 | internal static bool IsAzureSynapseOnDemandEndpoint(string dataSource) |
804 | 800 | { |
805 | | - return IsEndpoint(dataSource, s_azureSynapseOnDemandEndpoints); |
| 801 | + return IsEndpoint(dataSource, s_azureSynapseOnDemandEndpoints) |
| 802 | + || dataSource.IndexOf(AZURE_SYNAPSE, StringComparison.OrdinalIgnoreCase) >= 0; |
806 | 803 | } |
807 | 804 |
|
808 | 805 | internal static bool IsAzureSqlServerEndpoint(string dataSource) |
@@ -846,7 +843,7 @@ private static bool IsEndpoint(string dataSource, string[] endpoints) |
846 | 843 | // check if servername ends with any endpoints |
847 | 844 | foreach (var endpoint in endpoints) |
848 | 845 | { |
849 | | - if (length > endpoint.Length) |
| 846 | + if (length >= endpoint.Length) |
850 | 847 | { |
851 | 848 | if (string.Compare(dataSource, length - endpoint.Length, endpoint, 0, endpoint.Length, StringComparison.OrdinalIgnoreCase) == 0) |
852 | 849 | { |
|
0 commit comments