diff --git a/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerOptionsExtension.cs b/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerOptionsExtension.cs index 45e84a7ac5a..50e26c4e6a0 100644 --- a/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerOptionsExtension.cs +++ b/src/EFCore.SqlServer/Infrastructure/Internal/SqlServerOptionsExtension.cs @@ -114,12 +114,7 @@ public virtual SqlServerOptionsExtension WithCompatibilityLevel(int? compatibili /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual bool IsAzureSql - => _azureSql ?? IsAzureSqlDefault; - - private bool IsAzureSqlDefault - => (ConnectionString ?? Connection?.ConnectionString) - ?.Contains(".database.windows.net", StringComparison.InvariantCultureIgnoreCase) - == true; + => _azureSql ?? false; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to diff --git a/src/EFCore.SqlServer/SqlServerRetryingExecutionStrategy.cs b/src/EFCore.SqlServer/SqlServerRetryingExecutionStrategy.cs index beb9d0f7071..25874dcbfc5 100644 --- a/src/EFCore.SqlServer/SqlServerRetryingExecutionStrategy.cs +++ b/src/EFCore.SqlServer/SqlServerRetryingExecutionStrategy.cs @@ -31,9 +31,9 @@ public class SqlServerRetryingExecutionStrategy : ExecutionStrategy private readonly HashSet? _additionalErrorNumbers; /// - /// The default minimum time delay between retries for Azure SQL. + /// The default minimum time delay between retries for throttling errors. /// - protected static readonly TimeSpan DefaultMinDelayAzureSql = TimeSpan.FromSeconds(5); + protected static readonly TimeSpan DefaultMinDelayThrottling = TimeSpan.FromSeconds(5); /// /// Creates a new instance of . @@ -193,7 +193,7 @@ protected override bool ShouldRetryOn(Exception exception) return CallOnWrappedException(lastException, IsMemoryOptimizedError) ? TimeSpan.FromMilliseconds(baseDelay.Value.TotalSeconds) : CallOnWrappedException(lastException, IsThrottlingError) - ? baseDelay + DefaultMinDelayAzureSql + ? baseDelay + DefaultMinDelayThrottling : baseDelay; } diff --git a/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs b/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs index ca26b919d74..8c5221563b7 100644 --- a/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs @@ -462,26 +462,20 @@ public class AzureSqlDatabase [InlineData(true)] [InlineData(false)] [ConditionalTheory] - public void Retry_on_failure_enabled_by_default_on_Azure_SQL(bool azure) + public void Retry_on_failure_not_enabled_by_default_on_Azure_SQL(bool configured) { - using var context = new NorthwindContext(azure); - if (azure) - { - Assert.IsType(context.Database.CreateExecutionStrategy()); - } - else - { - Assert.IsType(context.Database.CreateExecutionStrategy()); - } + using var context = new NorthwindContext(configured); + + Assert.IsType(context.Database.CreateExecutionStrategy()); } private class NorthwindContext : DbContext { - private readonly bool _isAzure; + private readonly bool _azureConfigured; - public NorthwindContext(bool azure) + public NorthwindContext(bool configured) { - _isAzure = azure; + _azureConfigured = configured; } public DbSet Customers { get; set; } @@ -493,7 +487,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) @"Server=test.database.windows.net:4040;Database=Test;ConnectRetryCount=0", a => { - if (!_isAzure) + if (_azureConfigured) { a.UseAzureSqlDefaults(false); } @@ -509,10 +503,10 @@ public class NonDefaultAzureSqlDatabase [InlineData(true)] [InlineData(false)] [ConditionalTheory] - public void Retry_on_failure_enabled_if_Azure_SQL_configured(bool azure) + public void Retry_on_failure_enabled_if_Azure_SQL_configured(bool configured) { - using var context = new NorthwindContext(azure); - if (azure) + using var context = new NorthwindContext(configured); + if (configured) { Assert.IsType(context.Database.CreateExecutionStrategy()); }