I've tried to have a search for anything related to a SqlAzureExecutionStrategy for EF core and came up empty handed.
Does anyone have any information around the need for setting an execution strategy when using EF Core and SQL Azure?
The SqlAzureExecutionStrategy will retry instantly the first time a transient failure occurs, but will delay longer between each retry until either the max retry limit is exceeded or the total time hits the max delay.
EnableRetryOnFailure() Configures the context to use the default retrying IExecutionStrategy. This strategy is specifically tailored to SQL Server (including SQL Azure). It is pre-configured with error numbers for transient errors that can be retried.
This is a high-level comparison and doesn't list every feature or explain differences between the same feature in different EF versions. The EF Core column indicates the product version in which the feature first appeared.
EF Core 6.0 itself is 31% faster executing queries.
In EF Core it's called SqlServerRetryingExecutionStrategy
as it is also useful for on-premise SQL Server if you are using memory-optimized tables for example.
It can be enabled in this way:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseSqlServer(
"<connection string>",
options => options.EnableRetryOnFailure());
}
See Connection Resiliency for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With