Class MaybePrimitives
- Namespace
- Trellis.Asp.Validation
- Assembly
- Trellis.Asp.dll
Closed list of STJ-native primitive types recognised by
MaybePrimitiveJsonConverterFactory and
MaybePrimitiveModelBinder<T>. Mirrors the
CompositeValueObjectJsonConverter<T> allowed list in Trellis.Primitives.
public static class MaybePrimitives
- Inheritance
-
MaybePrimitives
- Inherited Members
Remarks
Exposed as a non-generic static holder rather than as a member on MaybePrimitiveModelBinder<T> so the FrozenSet<T> is allocated once for the entire framework, not once per closed generic instantiation. Both the JSON converter factory and the model binder provider read from the same set, guaranteeing the wire-shape decision is identical for JSON body binding and route / query / header / form binding.
The rule is uniform: Maybe<T> is supported wherever T is a primitive
Trellis already supports directly. Shapes outside this list require the wire-shape DTO +
adapter pattern at the controller seam (Cookbook Recipe 14).
Fields
SupportedPrimitives
The closed allowed list of primitive types: string, decimal, int, long, short, byte, double, float, bool, Guid, DateTime, DateTimeOffset.
public static readonly FrozenSet<Type> SupportedPrimitives