Add EnableRetryOnFailure to SQL Server config

Added EnableRetryOnFailure option to the AddSqlServer method in Program.cs. This change configures the SQL Server connection to automatically retry on failure, improving the application's resilience to transient faults.
This commit is contained in:
Marco Minerva
2024-12-05 18:00:01 +01:00
parent 810b25c233
commit 0575482bff
+1
View File
@@ -22,6 +22,7 @@ builder.Services.AddSingleton(TimeProvider.System);
builder.Services.AddSqlServer<ApplicationDbContext>(builder.Configuration.GetConnectionString("SqlConnection"), options =>
{
options.UseVectorSearch();
options.EnableRetryOnFailure();
}, options =>
{
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);