Is it advised to always create a new retry provider for every connection / command or can they be re-used across many connections / commands. It is unclear from the documentation what the best practices are:
private static readonly SqlRetryLogicBaseProvider DefaultRetryProvider = SqlConfigurableRetryFactory.CreateIncrementalRetryProvider(
new SqlRetryLogicOption()
{
NumberOfTries = 5,
MaxTimeInterval = TimeSpan.FromSeconds(10)
}
);
//...
public IConnection GetConnection()
{
var connection = new SqlConnection(_options.ConnectionString);
connection.RetryLogicProvider = DefaultRetryProvider;
return connection;
}
vs creating it for every connection
public IConnection GetConnection()
{
var connection = new SqlConnection(_options.ConnectionString);
connection.RetryLogicProvider = SqlConfigurableRetryFactory.CreateIncrementalRetryProvider(...);
return connection;
}
Same thing goes for commands
Is it advised to always create a new retry provider for every connection / command or can they be re-used across many connections / commands. It is unclear from the documentation what the best practices are:
vs creating it for every connection
Same thing goes for commands