Member Junction
    Preparing search index...

    Represents a field in an instance of the BaseEntity class. This class is used to store the value of the field, dirty state, as well as other run-time information about the field. The class encapsulates the underlying field metadata and exposes some of the more commonly used properties from the entity field metadata.

    Marked @OptionalKeyedSpecialization(): hydration probes the ClassFactory with a '<Entity>.<Field>' key for EVERY field so that a per-field subclass CAN be registered, but none ever has been in practice — falling back to EntityField itself is the designed common case, not a resolution failure, so the factory must not warn about it.

    Index

    Constructors

    Properties

    SQLTypeValueRanges: {
        bigint: { max: number; min: number };
        decimal: { max: number; min: number };
        float: { max: number; min: number };
        int: { max: number; min: number };
        money: { max: number; min: number };
        numeric: { max: number; min: number };
        real: { max: number; min: number };
        smallint: { max: number; min: number };
        tinyint: { max: number; min: number };
    } = ...

    Static object containing the value ranges for various SQL number types. This is used to validate the value of the field when it is set or validated.

    Accessors

    • get ActiveStatusAssertions(): boolean

      Returns boolean

      No-op as of the active-status relocation. Active-status (deprecated/disabled) assertions are now enforced at BaseEntity.Get/Set/SetMany — the entry points genuine code uses — rather than on this low-level EntityField.Value accessor. There is therefore nothing to toggle at the field level. The getter always returns false and the setter is ignored; both remain only so existing callers that wrapped value reads in a save/disable/restore pattern (e.g. the provider SQL-build paths) continue to compile and behave correctly.

    • set ActiveStatusAssertions(_value: boolean): void

      Parameters

      • _value: boolean

      Returns void

    • get CreateSuppressed(): boolean

      True when field-level security bars this user from supplying the field's value on INSERT, so the save path must omit it and let the column take its database default.

      Deliberately DISTINCT from NotLoaded, even though both end in "leave this parameter out of the SP call". NotLoaded means "the hydration source omitted this key" and carries consequences this must not: it suppresses the _Clear companion, exempts the field from required/null validation, and forces Dirty to false. A create-suppressed field, by contrast, holds a perfectly real value the user typed — it is simply not one they are permitted to supply. Conflating them would silently disarm validation on fields a user IS allowed to create.

      Set per-save by the create-path gate and cleared at the start of every save, because the answer depends on the acting user and the same entity object can be saved by different users over its lifetime.

      Returns boolean

    • get Dirty(): boolean

      Returns true if the field is dirty, false otherwise. A field is considered dirty if the value is different from the old value. If the field is read only, it is never dirty. A NotLoaded field is never dirty either — its in-memory state is a construction artifact, not data, and nothing that was never loaded can have been changed.

      Returns boolean

    • get NotLoaded(): boolean

      True when the source this entity was hydrated from OMITTED this field's key — most commonly because field-level security stripped it before the payload reached us, but equally for any partial hydration. The field's in-memory state (its metadata default, else null) is a construction artifact, not data: the save path skips not-loaded fields entirely (the generated procs' ISNULL(@p, [Col]) merge then preserves the stored value), Dirty always reports false for them, and Validate exempts them from the required/null check.

      Deliberately DISTINCT from _NeverSet, which means "no set since construction," exists to permit the one-time write to ReadOnly fields on load, and is re-armed wholesale by InnerLoad — reusing it would conflate defaults with omissions. This flag is set only by the hydration paths (via MarkNotLoaded) when a source omits the key, is cleared by ANY explicit set (an intentional blind write to a read-denied field is a legitimate write-only update and must save), and is never present on new (unhydrated) entities — their fields legitimately hold metadata defaults for INSERT.

      Returns boolean

    • get Value(): any

      Returns the current value of the field.

      NOTE: This is a framework-internal accessor. It deliberately does NOT assert the field's active status (deprecated/disabled) — that assertion lives one layer up, at BaseEntity.Get/Set/SetMany, which are the entry points genuine code (and the generated strongly-typed accessors) flow through. Internal machinery (Dirty checks, validation, serialization, hydration, SQL build) reads this directly and must stay assertion-free.

      Returns any

    • set Value(value: any): void

      Sets the value of the field. If the field is read only, nothing happens. If the field is not read only, the value is set and the internal representation of the dirty flag is flipped if the value is different from the old value.

      Parameters

      • value: any

      Returns void

    Methods

    • Convenience method to format the value of the field. This method calls the static method on EntityFieldInfo to do the actual formatting.

      Parameters

      • decimals: number = 2
      • currency: string = 'USD'

      Returns string

    • Framework-internal: hydration paths call this for each field whose key the hydration source omitted. Application code should never need it — an explicit Value set clears the flag.

      Returns void

    • Resets the NeverSet flag - this is generally an internal method but is available when working with read only fields (mainly primary key fields) to allow them to be set/changed once after the object is created. This is useful for scenarios where you want to set a read only field after the object is created, but only once. This is typically used in the BaseEntity class when loading an entity from an array of values or the DB and reusing an existing object.

      Returns void

    • This method will set the internal Old Value which is used to track dirty state, to the current value of the field. This effectively resets the dirty state of the field to false. Use this method sparingly.

      Returns void

    • Restores the dirty-tracking baseline to a previously captured value. Used by graph rollback so a retried save still sees the pre-attempt dirty set.

      Parameters

      • value: unknown

      Returns void

    • Validates the current value of the field. If the field is read only, or if the field is marked to skip validation, nothing happens. If the field is not read only, and the field is not marked to skip validation, the value is checked against the validation rules defined in the metadata for the field.

      Returns ValidationResult