I have inherited SqlServerRetryingExecutionStrategy
from Code sample by Microsoft in GitHub, called MySQLServerRetryPolicy
class
I have added a cancellationtoken in ShouldRetryOn
overriden method in MySQLServerRetryPolicy
, so I could kill the NET.Core console by pressing Ctrl+C. Here is the code snippet below:
protected override bool ShouldRetryOn(Exception exception) {
_retryCancellationToken.ThrowIfCancellationRequested();}
Here is how I use MySQLServerRetryPolicy
:
builder.UseSqlServer(ConnectionString, options => {
options.ExecutionStrategy(exeStrategyDependencies=>
new MySQLServerRetryPolicy(
exeStrategyDependencies, _errorNumRetryList, RetryCancelToken.Token));
builder
variable above is type of DbContextOptionsBuilder
.
However, in the unit test, there is no output telling if the SQl retry policy running forever.
Question: How do I ignore or skip the SQL retry policy in the unit tests?