Table of Contents

Class TrimAttribute

Namespace
Trellis
Assembly
Trellis.Core.dll

Opts a RequiredString<TSelf>-derived value object into trim-before-validate. Without this attribute the input string is stored verbatim; with it the generator trims the input before any other check, so combined with NotDefaultAttribute a whitespace-only input trims to Empty and is rejected.

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

Remarks

Only valid on RequiredString<TSelf>-derived types; applying it to any other Required base raises generator error TRLS057. Applying [Trim, NotDefault] together is the recommended setup for any string mapped to a database column and recovers the legacy "reject null + empty + whitespace; auto-trim" behavior.

See Also