Beispiel #1
0
        /// <summary>
        /// Helper function that executes a block of code containing a DB call, with
        /// retry logic if the code throws a transient <see cref="SqlException"/>. <br/>
        /// The block of code is wrapped inside a transaction with a read-committed isolation level.
        /// </summary>
        protected async Task TransactionalDatabaseOperation(Func <Task> spCall, string dbName, string spName, CancellationToken cancellation = default)
        {
            using var trx = TransactionFactory.ReadCommitted();

            await RepositoryUtilities.ExponentialBackoff(spCall, Logger, dbName, spName, cancellation);

            trx.Complete();
        }
Beispiel #2
0
 /// <summary>
 /// Helper function that executes a block of code containing a DB call, with
 /// retry logic if the code throws a transient <see cref="SqlException"/>.
 /// </summary>
 protected async Task ExponentialBackoff(Func <Task> spCall, string dbName, string spName, CancellationToken cancellation = default)
 {
     await RepositoryUtilities.ExponentialBackoff(spCall, Logger, dbName, spName, cancellation);
 }