Table of Contents

Class NotDefaultAttribute

Namespace
Trellis
Assembly
Trellis.Core.dll

Opts a Required*-derived value object into per-type sentinel rejection. Without this attribute the bare base accepts every concrete value and rejects only null; with it the generator emits a sentinel-rejection check appropriate to the underlying primitive.

[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class NotDefaultAttribute : Attribute
Inheritance
NotDefaultAttribute
Inherited Members
Extension Methods

Remarks

The sentinel each base rejects when this attribute is applied:

Invalid on RequiredBool<TSelf> and RequiredEnum<TSelf> — those bases have no meaningful sentinel, so applying it there raises generator error TRLS058.

Properties

Code

Gets or sets an application-defined reason code that replaces the framework default on every failure this attribute produces.

public string? Code { get; set; }

Property Value

string

A non-empty code, or null to keep the framework default. Setting it to an empty or whitespace string is a generator error (TRLS060).

Remarks

The framework vocabulary is frozen so that one client catalog entry works across every Trellis service. An application that owns both ends of its own contract — it wrote the declaration and it writes the catalog key — may name the failure in its own terms instead, and nothing it does here can invalidate another party's catalog. An override carries no warning and no penalty.

See Also