Skip to content

Commit d05f5c1

Browse files
authored
Fix InvalidOperationException (#3918)
1 parent 63a5492 commit d05f5c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

entity-framework/core/miscellaneous/connection-resiliency.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ An execution strategy that automatically retries on failures needs to be able to
5151

5252
However, if your code initiates a transaction using `BeginTransaction()` you are defining your own group of operations that need to be treated as a unit, and everything inside the transaction would need to be played back shall a failure occur. You will receive an exception like the following if you attempt to do this when using an execution strategy:
5353

54-
> InvalidOperationException: The configured execution strategy 'SqlServerRetryingExecutionStrategy' does not support user initiated transactions. Use the execution strategy returned by 'DbContext.Database.CreateExecutionStrategy()' to execute all the operations in the transaction as a retriable unit.
54+
> InvalidOperationException: The configured execution strategy 'SqlServerRetryingExecutionStrategy' does not support user-initiated transactions. Use the execution strategy returned by 'DbContext.Database.CreateExecutionStrategy()' to execute all the operations in the transaction as a retriable unit.
5555
5656
The solution is to manually invoke the execution strategy with a delegate representing everything that needs to be executed. If a transient failure occurs, the execution strategy will invoke the delegate again.
5757

0 commit comments

Comments
 (0)