Core Concepts — Attributes, SmartEnums & Validation
Every generated primitive is a readonly partial record struct whose private constructor is bypassed only by generated factory and parser entry points.
[StrongId<T>]: Strongly-typed identifier backed byGuid,long,int, orstring(RejectEmpty = trueby default).[StringPrimitive]: Enforces length, regex, and normalization ([Trim],[UpperCase],[LowerCase],[Normalize],[NormalizeWhitespace]).[NumericPrimitive<T>]: Enforces numeric bounds withcheckedarithmetic inv3.0.0.[DatePrimitive]: NormalizesDateTimeto UTC inv3.0.0([BirthDate],[BusinessDate],[ExpirationDate],[DateRange],[TimeRange]).[SmartEnum<T>]: Exhaustive enumeration providingFromName(name, ignoreCase),TryFromName,All(ReadOnlyCollection<T>),Match(...),Map(...), andSwitch(...).[ValueObject]: Generates STJ validation hooks so deserialization enforcesCreate()invariants.[CustomValidator<TValidator>]: Hooks customICustomValidator<T>business rules into generatedCreate/TryCreate.
Core ships 39+ preconfigured attributes including [Email], [Phone], [Url], [Slug], [CountryCode], [CurrencyCode], [LanguageCode], [IBAN], [ISBN], [VIN], [IPAddress], [MacAddress], [HexColor], [PasswordHash], [Username], [Money], [Price], [TaxRate], [Percentage], [Discount], [Quantity], [Weight], [Height], [Distance], [Temperature], [Age], [Score], and [Rating].
.IsDefaultidentifies uninitializeddefault(T)values.- In
v3.0.0, explicit casts on defaultStrongId/DatePrimitivethrowInvalidOperationException, andToString()returnsstring.Empty.