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.
Перейти к файлу
microsoft-github-policy-service[bot] c380290381
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2023-06-13 17:52:56 +00:00
RetryOperationHelper Updates to NuGet package configuration. 2016-11-24 15:15:53 +00:00
RetryOperationHelperUnitTests Updates to NuGet package configuration. 2016-11-24 15:15:53 +00: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 Update to ReadMe to include updated usage image 2016-11-25 11:32:11 +00:00
RetryHelperUsageExampleImage.png Updated Usage Example Image 2016-11-25 11:31:45 +00:00
RetryOperationHelper.sln Updating UnitTest XUnit NuGet reference to latest stable version. 2016-05-10 11:41:38 +01:00
SECURITY.md Microsoft mandatory file 2023-06-02 21:18:13 +00: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.

#Demo Demo Chart

#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();
await RetryOperationHelper.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.

#Microsoft Open Source Code of Conduct This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.