Skip to content

Commit fc1b62a

Browse files
committed
Fixes #4
1 parent 55e5a22 commit fc1b62a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

LinkDotNet.Blog.Web/RegistrationExtensions/SqlRegistrationExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ public static void UseSqlAsStorageProvider(this IServiceCollection services)
1414

1515
services.AddScoped(s =>
1616
{
17-
var configuration = s.GetService<AppConfiguration>() ?? throw new ArgumentNullException(nameof(AppConfiguration));
17+
var configuration = s.GetService<AppConfiguration>() ?? throw new NullReferenceException(nameof(AppConfiguration));
1818
var connectionString = configuration.ConnectionString;
1919
var dbOptions = new DbContextOptionsBuilder()
20-
.UseSqlServer(connectionString)
20+
.UseSqlServer(connectionString, options => options.EnableRetryOnFailure(3, TimeSpan.FromSeconds(30), null))
2121
.Options;
2222

2323
return new BlogPostContext(dbOptions);
@@ -31,7 +31,7 @@ public static void UseSqliteAsStorageProvider(this IServiceCollection services)
3131

3232
services.AddScoped(s =>
3333
{
34-
var configuration = s.GetService<AppConfiguration>() ?? throw new ArgumentNullException(nameof(AppConfiguration));
34+
var configuration = s.GetService<AppConfiguration>() ?? throw new NullReferenceException(nameof(AppConfiguration));
3535
var connectionString = configuration.ConnectionString;
3636
var dbOptions = new DbContextOptionsBuilder()
3737
.UseSqlite(connectionString)

0 commit comments

Comments
 (0)