/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual TResult Execute <TState, TResult>( TState state, Func <DbContext, TState, TResult> operation, Func <DbContext, TState, ExecutionResult <TResult> > verifySucceeded) { try { return(operation(Dependencies.CurrentContext.Context, state)); } catch (Exception ex) when(ExecutionStrategy.CallOnWrappedException(ex, MySqlTransientExceptionDetector.ShouldRetryOn)) { throw new InvalidOperationException(MySqlStrings.TransientExceptionDetected, ex); } }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual async Task <TResult> ExecuteAsync <TState, TResult>( TState state, Func <DbContext, TState, CancellationToken, Task <TResult> > operation, Func <DbContext, TState, CancellationToken, Task <ExecutionResult <TResult> > > verifySucceeded, CancellationToken cancellationToken) { try { return(await operation(Dependencies.CurrentDbContext.Context, state, cancellationToken)); } catch (Exception ex) when(ExecutionStrategy.CallOnWrappedException(ex, SqlServerTransientExceptionDetector.ShouldRetryOn)) { throw new InvalidOperationException(SqlServerStrings.TransientExceptionDetected, ex); } }
public virtual TResult Execute <TState, TResult>( Func <TState, TResult> operation, Func <TState, ExecutionResult <TResult> > verifySucceeded, TState state) { try { return(operation(state)); } catch (Exception ex) { if (ExecutionStrategy.CallOnWrappedException(ex, SqlServerTransientExceptionDetector.ShouldRetryOn)) { throw new InvalidOperationException(SqlServerStrings.TransientExceptionDetected, ex); } throw; } }
public virtual TResult Execute <TState, TResult>( TState state, Func <DbContext, TState, TResult> operation, Func <DbContext, TState, ExecutionResult <TResult> > verifySucceeded) { try { return(operation(Dependencies.CurrentContext.Context, state)); } catch (Exception ex) { if (ExecutionStrategy.CallOnWrappedException(ex, NpgsqlTransientExceptionDetector.ShouldRetryOn)) { throw new InvalidOperationException("An exception has been raised that is likely due to a transient failure.", ex); } throw; } }
public virtual async Task <TResult> ExecuteAsync <TState, TResult>( TState state, Func <DbContext, TState, CancellationToken, Task <TResult> > operation, Func <DbContext, TState, CancellationToken, Task <ExecutionResult <TResult> > > verifySucceeded, CancellationToken cancellationToken) { try { return(await operation(Dependencies.CurrentDbContext.Context, state, cancellationToken)); } catch (Exception ex) { if (ExecutionStrategy.CallOnWrappedException(ex, MySqlTransientExceptionDetector.ShouldRetryOn)) { throw new InvalidOperationException("An exception has been raised that is likely due to a transient failure.", ex); } throw; } }