From 2d14366febea4fcd9c4712be754b55ad36a4a563 Mon Sep 17 00:00:00 2001 From: Kevin Matsubara Date: Mon, 14 Apr 2025 22:33:02 +0200 Subject: [PATCH] Add retry option for SQL server example. --- EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs b/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs index 1510287..1d430c5 100644 --- a/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs +++ b/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs @@ -42,6 +42,13 @@ public class DeadBallZoneLeagueDbContext : DbContext .HasName("GetEarliestMatch"); } + // This is an example override for SQL Server: + // protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=FootballLeague_EfCore; Encrypt=true", sqlOptions => { + // sqlOptions.EnableRetryOnFailure(maxRetryCount: 5, + // maxRetryDelay: TimeSpan.FromSeconds(5), + // errorNumbersToAdd: null); + // }); + protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) { // These apply to all the settings for all models.