Skip to content

Commit fe14506

Browse files
committed
Added retry on failiure
1 parent 3687092 commit fe14506

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/efcore/retry.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Retry on failure
2+
Entity Framework Core supports automatic retry on failure when saving changes to the database. This can be useful when working with a database that is subject to transient failures, such as a database on Azure SQL Database. The examples uses SQL Server but other providers, like PostgreSQL, also support this feature.
3+
4+
```csharp
5+
public void ConfigureServices(IServiceCollection services)
6+
{
7+
services.AddDbContext<MyDbContext>(options =>
8+
options.UseSqlServer("your_connection_string",
9+
sqlServerOptions =>
10+
{
11+
sqlServerOptions.EnableRetryOnFailure(
12+
maxRetryCount: 3,
13+
maxRetryDelay: TimeSpan.FromSeconds(5),
14+
errorNumbersToAdd: null);
15+
}));
16+
}
17+
```

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ nav:
8080
- Define maximum length for strings: efcore/maxlength_strings.md
8181
- LoadAsync: efcore/loadasync.md
8282
- In Memory database with SQLite: efcore/in_memory_sqlite.md
83+
- Retry on failure: efcore/retry.md
8384
- SplitQuery: efcore/splitquery.md
8485
- Logging:
8586
- logging/index.md

0 commit comments

Comments
 (0)