Read a preference value¶
This operation returns a cached preference value entirely from memory, without any database round-trip, using one of three Item indexer overloads to select the application/page/scope combination to search.
| Field | Value |
|---|---|
| Operation ID | OP-PREF-002 |
| Trigger | Consumer code accesses instance(key), instance(key, scope), or instance(app, page, key) |
| Inputs | Key (any object), optional PrefScope, optional explicit application/page |
| Outputs | The stored preference value (Object) or Nothing if not found |
| Primary components | clsPreferences.Item (three overloads) |
| Entry point | SAIF.Presentation\clsPreferences.vb |
Steps¶
- Normalize the key to a lower-case string (BR-PREF-002); if
inKeyisNothing, returnNothingimmediately. - If
inKeyisNothing: returnNothingwithout further processing. - Look up the matching
Preferencegroup byApplicationName(case-sensitive for the 2-argument overloads*, case-insensitive for the 3-argument overload) andPagename(derived viaPageKey(scope), which returnsPage.ToLower()only forPageLevelscope, else empty string) (BR-PREF-001). - If the group is found and contains the (lower-cased) key in
PreferenceItems, return the value; otherwise returnNothing. - If the group is not found: return
Nothing. - If the key is not present in
PreferenceItems: returnNothing.
No business-rule validation or error branching occurs beyond the above.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Item indexer accessed]) --> S1{Key is Nothing?}
S1 -->|Yes| EndNothing([Return Nothing])
S1 -->|No| S2[Normalize key to lower-case]
S2 --> S3[Find matching Preference group by app/page]
S3 --> S4{Group found and key present?}
S4 -->|Yes| EndValue([Return stored value])
S4 -->|No| EndNothing2([Return Nothing])
Failure and edge-case behavior¶
- A missing group or missing key both silently return
Nothing; no exception or error signal distinguishes "not found" from other conditions. - The 2-argument
Itemoverloads compareApplicationNamecase-sensitively, while the 3-argument overload lowercases bothApplicationNameandPagenamebefore comparing — an inconsistency in case-handling between overloads*.
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Related documentation¶
Sources¶
- SAIF.Presentation\clsPreferences.vb