From d05f5c1903464178d9743f88ec31c76d66a95c0e Mon Sep 17 00:00:00 2001 From: Andreas Gyr Date: Mon, 4 Jul 2022 10:54:12 +0200 Subject: [PATCH] Fix InvalidOperationException (#3918) --- entity-framework/core/miscellaneous/connection-resiliency.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entity-framework/core/miscellaneous/connection-resiliency.md b/entity-framework/core/miscellaneous/connection-resiliency.md index f6effd4db4..219bc39797 100644 --- a/entity-framework/core/miscellaneous/connection-resiliency.md +++ b/entity-framework/core/miscellaneous/connection-resiliency.md @@ -51,7 +51,7 @@ An execution strategy that automatically retries on failures needs to be able to 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: -> 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. +> 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. 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.