Interface ISyncPolicy
- Namespace
- Polly
- Assembly
- Polly.dll
An interface defining all executions available on a non-generic, synchronous policy
public interface ISyncPolicy : IsPolicy
- Inherited Members
Methods
Execute(Action)
Executes the specified action within the policy.
void Execute(Action action)
Parameters
action
ActionThe action to perform.
Execute(Action<Context, CancellationToken>, Context, CancellationToken)
Executes the specified action within the policy.
void Execute(Action<Context, CancellationToken> action, Context context, CancellationToken cancellationToken)
Parameters
action
Action<Context, CancellationToken>The action to perform.
context
ContextContext data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Execute(Action<Context, CancellationToken>, IDictionary<string, object>, CancellationToken)
Executes the specified action within the policy.
void Execute(Action<Context, CancellationToken> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)
Parameters
action
Action<Context, CancellationToken>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Exceptions
- ArgumentNullException
contextData
Execute(Action<Context>, Context)
Executes the specified action within the policy.
void Execute(Action<Context> action, Context context)
Parameters
action
Action<Context>The action to perform.
context
ContextContext data that is passed to the exception policy.
Execute(Action<Context>, IDictionary<string, object>)
Executes the specified action within the policy.
void Execute(Action<Context> action, IDictionary<string, object> contextData)
Parameters
action
Action<Context>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
Execute(Action<CancellationToken>, CancellationToken)
void Execute(Action<CancellationToken> action, CancellationToken cancellationToken)
Parameters
action
Action<CancellationToken>cancellationToken
CancellationToken
ExecuteAndCapture(Action)
Executes the specified action within the policy and returns the captured result
PolicyResult ExecuteAndCapture(Action action)
Parameters
action
ActionThe action to perform.
Returns
- PolicyResult
The captured result
ExecuteAndCapture(Action<Context, CancellationToken>, Context, CancellationToken)
Executes the specified action within the policy and returns the captured result
PolicyResult ExecuteAndCapture(Action<Context, CancellationToken> action, Context context, CancellationToken cancellationToken)
Parameters
action
Action<Context, CancellationToken>The action to perform.
context
ContextContext data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- PolicyResult
The captured result
ExecuteAndCapture(Action<Context, CancellationToken>, IDictionary<string, object>, CancellationToken)
Executes the specified action within the policy and returns the captured result.
PolicyResult ExecuteAndCapture(Action<Context, CancellationToken> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)
Parameters
action
Action<Context, CancellationToken>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- PolicyResult
The captured result
Exceptions
- ArgumentNullException
contextData
ExecuteAndCapture(Action<Context>, Context)
Executes the specified action within the policy and returns the captured result.
PolicyResult ExecuteAndCapture(Action<Context> action, Context context)
Parameters
action
Action<Context>The action to perform.
context
ContextContext data that is passed to the exception policy.
Returns
- PolicyResult
The captured result
ExecuteAndCapture(Action<Context>, IDictionary<string, object>)
Executes the specified action within the policy and returns the captured result.
PolicyResult ExecuteAndCapture(Action<Context> action, IDictionary<string, object> contextData)
Parameters
action
Action<Context>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
Returns
- PolicyResult
The captured result
Exceptions
- ArgumentNullException
contextData
ExecuteAndCapture(Action<CancellationToken>, CancellationToken)
Executes the specified action within the policy and returns the captured result
PolicyResult ExecuteAndCapture(Action<CancellationToken> action, CancellationToken cancellationToken)
Parameters
action
Action<CancellationToken>The action to perform.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- PolicyResult
The captured result
ExecuteAndCapture<TResult>(Func<Context, CancellationToken, TResult>, Context, CancellationToken)
Executes the specified action within the policy and returns the captured result.
PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
Parameters
action
Func<Context, CancellationToken, TResult>The action to perform.
context
ContextContext data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- PolicyResult<TResult>
The captured result
Type Parameters
TResult
ExecuteAndCapture<TResult>(Func<Context, CancellationToken, TResult>, IDictionary<string, object>, CancellationToken)
Executes the specified action within the policy and returns the captured result.
PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<Context, CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)
Parameters
action
Func<Context, CancellationToken, TResult>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- PolicyResult<TResult>
The captured result
Type Parameters
TResult
The type of the result.
Exceptions
- ArgumentNullException
contextData
ExecuteAndCapture<TResult>(Func<Context, TResult>, Context)
Executes the specified action within the policy and returns the captured result.
PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<Context, TResult> action, Context context)
Parameters
action
Func<Context, TResult>The action to perform.
context
ContextContext data that is passed to the exception policy.
Returns
- PolicyResult<TResult>
The captured result
Type Parameters
TResult
Exceptions
- ArgumentNullException
contextData
ExecuteAndCapture<TResult>(Func<Context, TResult>, IDictionary<string, object>)
Executes the specified action within the policy and returns the captured result.
PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<Context, TResult> action, IDictionary<string, object> contextData)
Parameters
action
Func<Context, TResult>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
Returns
- PolicyResult<TResult>
The captured result
Type Parameters
TResult
Exceptions
- ArgumentNullException
contextData
ExecuteAndCapture<TResult>(Func<CancellationToken, TResult>, CancellationToken)
Executes the specified action within the policy and returns the captured result
PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<CancellationToken, TResult> action, CancellationToken cancellationToken)
Parameters
action
Func<CancellationToken, TResult>The action to perform.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- PolicyResult<TResult>
The captured result
Type Parameters
TResult
The type of the t result.
ExecuteAndCapture<TResult>(Func<TResult>)
Executes the specified action within the policy and returns the captured result
PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<TResult> action)
Parameters
action
Func<TResult>The action to perform.
Returns
- PolicyResult<TResult>
The captured result
Type Parameters
TResult
Execute<TResult>(Func<Context, CancellationToken, TResult>, Context, CancellationToken)
Executes the specified action within the policy and returns the result.
TResult Execute<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
Parameters
action
Func<Context, CancellationToken, TResult>The action to perform.
context
ContextContext data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TResult
The value returned by the action
Type Parameters
TResult
The type of the result.
Execute<TResult>(Func<Context, CancellationToken, TResult>, IDictionary<string, object>, CancellationToken)
Executes the specified action within the policy and returns the result.
TResult Execute<TResult>(Func<Context, CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)
Parameters
action
Func<Context, CancellationToken, TResult>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TResult
The value returned by the action
Type Parameters
TResult
The type of the result.
Exceptions
- ArgumentNullException
contextData
Execute<TResult>(Func<Context, TResult>, Context)
Executes the specified action within the policy and returns the result.
TResult Execute<TResult>(Func<Context, TResult> action, Context context)
Parameters
action
Func<Context, TResult>The action to perform.
context
ContextContext data that is passed to the exception policy.
Returns
- TResult
The value returned by the action
Type Parameters
TResult
The type of the result.
Exceptions
- ArgumentNullException
contextData
- ArgumentNullException
contextData
Execute<TResult>(Func<Context, TResult>, IDictionary<string, object>)
Executes the specified action within the policy and returns the result.
TResult Execute<TResult>(Func<Context, TResult> action, IDictionary<string, object> contextData)
Parameters
action
Func<Context, TResult>The action to perform.
contextData
IDictionary<string, object>Arbitrary data that is passed to the exception policy.
Returns
- TResult
The value returned by the action
Type Parameters
TResult
The type of the result.
Exceptions
- ArgumentNullException
contextData
- ArgumentNullException
contextData
Execute<TResult>(Func<CancellationToken, TResult>, CancellationToken)
Executes the specified action within the policy and returns the result.
TResult Execute<TResult>(Func<CancellationToken, TResult> action, CancellationToken cancellationToken)
Parameters
action
Func<CancellationToken, TResult>The action to perform.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TResult
The value returned by the action
Type Parameters
TResult
The type of the result.
Execute<TResult>(Func<TResult>)
Executes the specified action within the policy and returns the Result.
TResult Execute<TResult>(Func<TResult> action)
Parameters
action
Func<TResult>The action to perform.
Returns
- TResult
The value returned by the action
Type Parameters
TResult
The type of the Result.
WithPolicyKey(string)
Sets the PolicyKey for this Policy instance.
ISyncPolicy WithPolicyKey(string policyKey)