Retry Operation Helper is a simple class which encapsulates the retry of any given piece of C# .NET logic a given number of times before failing, as well as running an optional function on failure. It is useful for any call where transient exception are possible, for example, making a call to a remote database or service.
Перейти к файлу
Conor Kelly 1d10182e51 Adding Sample Retry Operation Helper Call image for documentation. 2016-05-11 11:00:55 +01:00
RetryOperationHelper Commit of RetryOperationHelper project and associated UnitTests 2016-05-09 13:12:33 +01:00
RetryOperationHelperUnitTests Updating UnitTest XUnit NuGet reference to latest stable version. 2016-05-10 11:41:38 +01:00
.gitignore Updating root .gitignore to ignore unnescessary files. 2016-05-09 16:26:58 +01:00
LICENSE.TXT Commit of RetryOperationHelper project and associated UnitTests 2016-05-09 13:12:33 +01:00
README.md Adding sample code to Readme file. 2016-05-11 10:57:52 +01:00
RetryOperationHelper.sln Updating UnitTest XUnit NuGet reference to latest stable version. 2016-05-10 11:41:38 +01:00
SampleRetryOperationHelperCall.png Adding Sample Retry Operation Helper Call image for documentation. 2016-05-11 11:00:55 +01:00
THIRD-PARTY-NOTICES.txt Commit of RetryOperationHelper project and associated UnitTests 2016-05-09 13:12:33 +01:00

README.md

RetryOperationHelper

Retry Operation Helper is a simple class which encapsulates the retry of any given piece of C# .NET logic a given number of times before failing, as well as running an optional function on failure. It is useful for any call where transient exception are possible, for example, making a call to a remote database or service.

#Licenses Retry Operation Helper is licensed under the MIT license.

RetryOperationHelper uses third-party libraries or other resources that may be distributed under licenses different than RetryOperationHelper.

#Usage Create a RetryOperationHelper object and pass it a Func<> object containing whatever piece of logic you need retried. From then on, that logic will be retried the given number of times before the exception is thrown back to the original thread. For example, the code goes from this:

await sqlExecutionEngine.ExecuteSqlOperation();

to

Func<Task> func = () => sqlExecutionEngine.ExecuteSqlOperation();
var retryHelper = new RetryOperationHelper(); 
await retryHelper.ExecuteWithRetry(func, 3); 

It is useful for code calling databases or anywhere transient issues may be present. Always pass atomic pieces of logic, usually a single call, given the entire code block will be retried if any part of it throws an exception.