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.
User contributions licensed under CC BY-SA 3.0