Class RepresentationMetadata
- Namespace
- Trellis
- Assembly
- Trellis.Results.dll
Carries HTTP representation metadata (RFC 9110 ยง8) through Trellis response mappers.
Used to emit ETag, Last-Modified, Vary, Content-Language,
Content-Location, and Accept-Ranges response headers consistently
across MVC and Minimal API responses (200, 201, 206, 304).
public sealed class RepresentationMetadata
- Inheritance
-
RepresentationMetadata
- Inherited Members
- Extension Methods
Properties
AcceptRanges
Gets the Accept-Ranges value (e.g., "bytes" or "none").
public string? AcceptRanges { get; }
Property Value
ContentLanguage
Gets the Content-Language values for the selected representation.
public IReadOnlyList<string>? ContentLanguage { get; }
Property Value
ContentLocation
Gets the Content-Location URI for the selected representation.
public string? ContentLocation { get; }
Property Value
ETag
Gets the entity tag validator for the selected representation.
public EntityTagValue? ETag { get; }
Property Value
LastModified
Gets the last modification date of the selected representation.
public DateTimeOffset? LastModified { get; }
Property Value
Vary
Gets the Vary header field names indicating which request fields influenced selection.
public IReadOnlyList<string>? Vary { get; }
Property Value
Methods
Create()
Creates a new RepresentationMetadata.Builder for constructing RepresentationMetadata.
public static RepresentationMetadata.Builder Create()
Returns
WithETag(EntityTagValue)
Creates metadata with just an ETag.
public static RepresentationMetadata WithETag(EntityTagValue eTag)
Parameters
eTagEntityTagValueThe entity tag value.
Returns
- RepresentationMetadata
A new RepresentationMetadata containing only the specified ETag.
WithStrongETag(string)
Creates metadata with just a strong ETag from an opaque tag string.
public static RepresentationMetadata WithStrongETag(string opaqueTag)
Parameters
opaqueTagstringThe opaque tag string for a strong entity tag.
Returns
- RepresentationMetadata
A new RepresentationMetadata containing only a strong ETag.