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

Context

public class Context : IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable, IDictionary, ICollection, IReadOnlyDictionary<string, object>, IReadOnlyCollection<KeyValuePair<string, object>>
Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added. Do not re-use an instance of Context across more than one call through .Execute(...) or .ExecuteAsync(...).
public Guid CorrelationId { get; }

Gets a GUID guaranteed to be unique to each execution. Acts as a correlation id so that events specific to a single execution can be identified in logging and telemetry.

public int Count { get; }

public object this[string key] { get; set; }

public ICollection<string> Keys { get; }

public string OperationKey { get; }

Gets a key unique to the call site of the current execution. Policy instances are commonly reused across multiple call sites. Set an OperationKey so that logging and metrics can distinguish usages of policy instances at different call sites.The value is set by using the #ctor constructor taking an operationKey parameter.

public string PolicyKey { get; }

Gets the PolicyKey of the policy instance executing the current delegate.

public string PolicyWrapKey { get; }

Gets the wrapped PolicyKey. When execution is through a PolicyWrap, identifies the PolicyWrap executing the current delegate by returning the PolicyKey of the outermost layer in the PolicyWrap; otherwise, null.

public ICollection<object> Values { get; }

public Context(string operationKey)

Initializes a new instance of the Context class, with the specified operationKey.

public Context()

Initializes a new instance of the Context class.

public Context(string operationKey, IDictionary<string, object> contextData)

Initializes a new instance of the Context class, with the specified operationKey and the supplied contextData.

public void Add(string key, object value)

public void Add(object key, object value)

public void Clear()

public bool Contains(object key)

public bool ContainsKey(string key)

public void CopyTo(Array array, int index)

public IEnumerator<KeyValuePair<string, object>> GetEnumerator()

public bool Remove(string key)

public void Remove(object key)

public bool TryGetValue(string key, out object value)