Interface IRepresentationValidator<T>
Strategy for generating representation-specific validators (ETags) that account for content negotiation variants per RFC 9110 §8.8.3.1/§8.8.3.3.
public interface IRepresentationValidator<in T>
Type Parameters
TThe domain type being represented.
- Extension Methods
Remarks
The default Trellis behavior generates ETags from aggregate state only. When the same resource has multiple representations (different encodings, languages, media types, or projections), each variant needs a distinct ETag.
Implement this interface to combine domain version with variant metadata. Register as a service; Trellis response mappers will use it when available.
Methods
GenerateETag(T, string?)
Generates an EntityTagValue for the given value and representation variant.
EntityTagValue GenerateETag(T value, string? variantKey = null)
Parameters
valueTThe domain value.
variantKeystringOptional variant key (e.g., encoding, language, projection ID).
Returns
- EntityTagValue
The entity tag for this specific representation.