<PackageReference Include="Polly" Version="8.3.1" />

ISyncPolicy<TResult>

public interface ISyncPolicy<TResult> : IsPolicy
An interface defining all executions available on a synchronous policy generic-typed for executions returning results of type TResult.
TResult Execute(Func<TResult> action)

Executes the specified action within the policy and returns the Result.

TResult Execute(Func<Context, TResult> action, IDictionary<string, object> contextData)

Executes the specified action within the policy and returns the result.

TResult Execute(Func<Context, TResult> action, Context context)

Executes the specified action within the policy and returns the result.

TResult Execute(Func<CancellationToken, TResult> action, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

TResult Execute(Func<Context, CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

TResult Execute(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

PolicyResult<TResult> ExecuteAndCapture(Func<TResult> action)

Executes the specified action within the policy and returns the captured result.

PolicyResult<TResult> ExecuteAndCapture(Func<Context, TResult> action, IDictionary<string, object> contextData)

Executes the specified action within the policy and returns the captured result.

PolicyResult<TResult> ExecuteAndCapture(Func<Context, TResult> action, Context context)

Executes the specified action within the policy and returns the captured result.

PolicyResult<TResult> ExecuteAndCapture(Func<CancellationToken, TResult> action, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result.

PolicyResult<TResult> ExecuteAndCapture(Func<Context, CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result.

PolicyResult<TResult> ExecuteAndCapture(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result.

ISyncPolicy<TResult> WithPolicyKey(string policyKey)

Sets the PolicyKey for this Policy instance. Must be called before the policy is first used. Can only be set once.