@@ -202,14 +202,15 @@ public static IServiceCollection AddCustomHealthCheck(this IServiceCollection se
202202
203203 public static IServiceCollection AddCustomDbContext ( this IServiceCollection services , IConfiguration configuration )
204204 {
205- services . AddDbContext < CatalogContext > ( options =>
205+ services . AddEntityFrameworkSqlServer ( )
206+ . AddDbContext < CatalogContext > ( options =>
206207 {
207208 options . UseSqlServer ( configuration [ "ConnectionString" ] ,
208209 sqlServerOptionsAction : sqlOptions =>
209210 {
210211 sqlOptions . MigrationsAssembly ( typeof ( Startup ) . GetTypeInfo ( ) . Assembly . GetName ( ) . Name ) ;
211212 //Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
212- sqlOptions . EnableRetryOnFailure ( maxRetryCount : 10 , maxRetryDelay : TimeSpan . FromSeconds ( 30 ) , errorNumbersToAdd : null ) ;
213+ sqlOptions . EnableRetryOnFailure ( maxRetryCount : 15 , maxRetryDelay : TimeSpan . FromSeconds ( 30 ) , errorNumbersToAdd : null ) ;
213214 } ) ;
214215
215216 // Changing default behavior when client evaluation occurs to throw.
@@ -225,7 +226,7 @@ public static IServiceCollection AddCustomDbContext(this IServiceCollection serv
225226 {
226227 sqlOptions . MigrationsAssembly ( typeof ( Startup ) . GetTypeInfo ( ) . Assembly . GetName ( ) . Name ) ;
227228 //Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
228- sqlOptions . EnableRetryOnFailure ( maxRetryCount : 10 , maxRetryDelay : TimeSpan . FromSeconds ( 30 ) , errorNumbersToAdd : null ) ;
229+ sqlOptions . EnableRetryOnFailure ( maxRetryCount : 15 , maxRetryDelay : TimeSpan . FromSeconds ( 30 ) , errorNumbersToAdd : null ) ;
229230 } ) ;
230231 } ) ;
231232
0 commit comments