diff --git a/src/EFCore.SqlServer/Infrastructure/SqlEngineDbContextOptionsBuilder.cs b/src/EFCore.SqlServer/Infrastructure/SqlEngineDbContextOptionsBuilder.cs index b08b3ac26a2..510375b83b2 100644 --- a/src/EFCore.SqlServer/Infrastructure/SqlEngineDbContextOptionsBuilder.cs +++ b/src/EFCore.SqlServer/Infrastructure/SqlEngineDbContextOptionsBuilder.cs @@ -60,7 +60,7 @@ public virtual SqlEngineDbContextOptionsBuilder EnableRetryOnFailure() /// for more information and examples. /// /// - public virtual SqlEngineDbContextOptionsBuilder TryEnableRetryOnFailure() + public virtual SqlEngineDbContextOptionsBuilder EnableRetryOnFailureByDefault() => WithOption(e => e.WithUseRetryingStrategyByDefault(true)); /// diff --git a/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs b/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs index 426b89bf5d6..7b21c1e444d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs @@ -769,7 +769,7 @@ public void Fallback_execution_strategy_used() { using var scope = new ServiceCollection() .AddDbContext(b => b.UseSqlServer()) - .ConfigureDbContext(b => b.ConfigureSqlEngine(o => o.TryEnableRetryOnFailure())) + .ConfigureDbContext(b => b.ConfigureSqlEngine(o => o.EnableRetryOnFailureByDefault())) .BuildServiceProvider(validateScopes: true) .CreateScope(); @@ -799,7 +799,7 @@ public void Fallback_execution_strategy_does_not_overwrite_Add_first() { using var scope = new ServiceCollection() .AddDbContext(b => b.UseSqlServer(o => o.ExecutionStrategy(_ => new DummyExecutionStrategy()))) - .ConfigureDbContext(b => b.ConfigureSqlEngine(o => o.TryEnableRetryOnFailure())) + .ConfigureDbContext(b => b.ConfigureSqlEngine(o => o.EnableRetryOnFailureByDefault())) .BuildServiceProvider(validateScopes: true) .CreateScope(); @@ -813,7 +813,7 @@ public void Fallback_execution_strategy_does_not_overwrite_Add_first() public void Fallback_execution_strategy_does_not_overwrite_Configure_first() { using var scope = new ServiceCollection() - .ConfigureDbContext(b => b.ConfigureSqlEngine(o => o.TryEnableRetryOnFailure())) + .ConfigureDbContext(b => b.ConfigureSqlEngine(o => o.EnableRetryOnFailureByDefault())) .AddDbContext(b => b.UseSqlServer(o => o.ExecutionStrategy(_ => new DummyExecutionStrategy()))) .BuildServiceProvider(validateScopes: true) .CreateScope();