Class GovernanceHttpRequestCorrelation
- Namespace
- AsiBackbone.AspNetCore.Correlation
- Assembly
- AsiBackbone.AspNetCore.dll
Represents framework-neutral request correlation data resolved from the current ASP.NET Core HTTP request.
public sealed class GovernanceHttpRequestCorrelation
- Inheritance
-
GovernanceHttpRequestCorrelation
- Inherited Members
- Extension Methods
Remarks
Initializes a new instance of the GovernanceHttpRequestCorrelation class.
Constructors
GovernanceHttpRequestCorrelation(string?, string?, IReadOnlyDictionary<string, string>?)
Represents framework-neutral request correlation data resolved from the current ASP.NET Core HTTP request.
public GovernanceHttpRequestCorrelation(string? correlationId = null, string? traceId = null, IReadOnlyDictionary<string, string>? metadata = null)
Parameters
correlationIdstringThe resolved correlation identifier, when available.
traceIdstringThe resolved trace identifier, when available.
metadataIReadOnlyDictionary<string, string>Safe request metadata resolved from the host.
Remarks
Initializes a new instance of the GovernanceHttpRequestCorrelation class.
Properties
CorrelationId
Gets the request correlation identifier, when supplied by the host or propagated request headers.
public string? CorrelationId { get; }
Property Value
HasMetadata
Gets a value indicating whether safe request metadata is available.
public bool HasMetadata { get; }
Property Value
Metadata
Gets safe request metadata supplied by the ASP.NET Core adapter.
public IReadOnlyDictionary<string, string> Metadata { get; }
Property Value
TraceId
Gets the request trace identifier, when supplied by the host or current activity.
public string? TraceId { get; }
Property Value
Methods
MergeMetadata(IReadOnlyDictionary<string, string>?)
Merges safe request metadata with host-provided metadata.
public IReadOnlyDictionary<string, string> MergeMetadata(IReadOnlyDictionary<string, string>? metadata)
Parameters
metadataIReadOnlyDictionary<string, string>Optional host-provided metadata.
Returns
- IReadOnlyDictionary<string, string>
A normalized metadata dictionary.
ToEvaluationContext(string?, string?, IReadOnlyDictionary<string, string>?, bool)
Creates a framework-neutral constraint evaluation context from the resolved request correlation data.
public GovernanceEvaluationContext ToEvaluationContext(string? policyVersion = null, string? policyHash = null, IReadOnlyDictionary<string, string>? metadata = null, bool mergeRequestMetadata = true)
Parameters
policyVersionstringOptional policy version.
policyHashstringOptional policy hash.
metadataIReadOnlyDictionary<string, string>Optional host-provided metadata to merge with safe request metadata.
mergeRequestMetadataboolWhen true (the default), Metadata is merged underneath
metadata. Pass false whenmetadataalready contains request metadata and is authoritative — for example after sanitization, where re-merging would reintroduce entries the sanitizer removed.metadatais still key-normalized either way.
Returns
- GovernanceEvaluationContext
A framework-neutral constraint evaluation context.