System data updateexception an error occurred while updating the entries
In the first step, I simply implemented my own Should Retry On method, which I used for setting a breakpoint. In the last trace, you can see the decreased max Delay.
Update(IEntity State Manager state Manager, IEntity Adapter adapter) D; at System. But with my special problem, it was not really useful. max Delay does not set the duration of the complete operation (from first try until last retry). Instead it limits only the delay between two retries.,117 Task 1: UPDATE [dbo].[T_Message] SET [Last Update] = @0 WHERE ([Messageid] = @1) ,119 Task 1: -- @0: '3/5/2014 AM' (Type = Date Time2) ,119 Task 1: -- @1: '3621840d-724e-4a62-b22a-accb215dfb1b' (Type = Guid) ,120 Task 1: -- Executing at 3/5/2014 AM ,130 Task 1: -- Completed in 6 ms with result: 1,430 Task 2: UPDATE [dbo].[T_Message] SET [Last Update] = @0 WHERE ([Messageid] = @1) ,431 Task 2: -- @0: '3/5/2014 AM' (Type = Date Time2) ,431 Task 2: -- @1: '3621840d-724e-4a62-b22a-accb215dfb1b' (Type = Guid) ,431 Task 2: -- Executing at 3/5/2014 AM ,557 Task 2: -- Failed in 5124 ms with error: Timeout expired. Since the method is protected, I decided to implement my own strategy derived from Sql Azure Execution Strategy. With a max Delay of 5, we get par example: 0, 1, 3, 5, 5, 5, 5, ...One of my favorite features of Entity Framework 6 was the Sql Azure Execution Strategy. I wanted to use it also in my company’s network since we get periodically timeouts connecting to a SQL Server instance (SQL Server 2008 in this case). My approach was to write a sample program starting two tasks: Unfortunately, this approach did not work since the "retrying execution strategies" do not support user-initiated transactions (see Limitations with Retrying Execution Strategies (EF6 onwards)).So I thought, perfect, the Sql Azure Execution Strategy is the solution to my problem. To my rescue, the mentioned article describes also a workaround which prevents the usage of the Sql Azure Execution Strategy together with the transaction: Now the program was running again, but I still got the Sql Exception with the timeout. My final issue was that I did misunderstand the optional parameters of Sql Azure Execution Strategy: max Retry Count is simply the maximum number of retries. The delay between the retries is connected to retry number and the power of 2.