ShouldRetryOn in DbExecutionStrategy not always works

1

Mostly it works but sometimes I receive error messages:

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-03135: Connection lost contact

... in C:\xxx\Controllers\XController.cs:line 108

So line 108 is return StatusCode(HttpStatusCode.ExpectationFailed); Weird....


class MyDbConfiguration : DbConfiguration
{
    public MyDbConfiguration()
    {
        SetExecutionStrategy("Oracle.ManagedDataAccess.Client", () => new MyDbExecutionStrategy(3, TimeSpan.FromSeconds(0)));
    }
}

public class MyDbExecutionStrategy : DbExecutionStrategy
{
    public MyDbExecutionStrategy(int maxRetryCount, TimeSpan maxDelay)
        : base(maxRetryCount, maxDelay)        {        }

    protected override bool ShouldRetryOn(Exception ex)
    {
        return true; // for simplicity
    }
}

I had to do another wrapper and catch Oracle errors manually to overcome this. When I debug and simulate DB error the execution consistently goes into ShouldRetryOn method.

c#
entity-framework-6
oracle-manageddataaccess
asked on Stack Overflow Jul 27, 2019 by Toolkit • edited Jul 28, 2019 by Toolkit

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0