---
title: Construct and load a user's preferences
summary: Loads every stored preference for a user and application into memory on construction.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation
reference_type: package
operation_id: OP-PRES-001
trigger: A consuming application creates a preference store for the signed-in user
---

# Construct and load a user's preferences

This operation runs on every `clsPreferences` construction path. It establishes an Oracle data portal for the fixed user `CLM`, then eagerly loads every stored preference record for the effective (data-portal) user into memory, so that subsequent reads incur no further database round trips.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-PRES-001 |
| **Trigger** | Caller invokes `New clsPreferences(inUserID, inApplication)` or the three-argument overload |
| **Inputs** | `inUserID`, `inApplication` (the third `preferencesRootDirectory` parameter is accepted but ignored) |
| **Outputs** | A populated in-memory `List(Of Preference)` |
| **Primary components** | `clsPreferences.New`, `clsPreferences.Initialize`, `clsPreferences.Load` |
| **Entry point** | `SAIF.Presentation/clsPreferences.vb` |

## Steps

1. Log method entry via `clsLogTrace.MethodBegin()`. Delegates to `SAIF.Framework.Logging`; the callee's own steps are not visible from this repository.**
2. Store the application name and allocate an empty `List(Of Preference)` ([BR-PRES-001](../business-rules.md#br-pres-001-preference-store-scoped-to-one-application)).
3. Construct `clsMSOracleDataLayer` with the hard-coded database user `CLM` and the database name returned by `AppGlobal.EnvironmentService.GetConfigSetting(EnvironmentConfigKeys.OracleDatabase)` ([BR-PRES-002](../business-rules.md#br-pres-002-preference-access-uses-the-fixed-oracle-user-clm)).
   - This step delegates to the SAIF framework environment service and BOF data layer; their internal step sequences are not visible from this repository.**
4. Obtain an `IDataPortalInfo` from the data layer (`m_DAL.DataPortalInfo()`). The portal supplies the effective `UserID` used for all subsequent reads and writes ([BR-PRES-003](../business-rules.md#br-pres-003-effective-user-identity-comes-from-the-data-portal)).
5. Construct `PreferenceData(m_DPI)` and call `GetPreferencesForUser(m_DPI.UserID.Trim.ToLower())`, storing the result in `_Preferences` ([BR-PRES-004](../business-rules.md#br-pres-004-all-preferences-loaded-eagerly-on-construction), [BR-PRES-005](../business-rules.md#br-pres-005-user-id-trimmed-and-lower-cased-for-lookup)).
   - Delegates to `SAIF.Framework.Preferences.PreferenceData.GetPreferencesForUser` (package `SAIF.BOF.Framework`); the underlying data access is owned by that package and is not visible from this repository.**
   - Note: the `inUserID` constructor argument is **not** used for the load — the user identity actually used is `m_DPI.UserID` from the data portal.
6. Null the local `PreferenceData` reference and log method exit.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([New clsPreferences]) --> S1[Log method entry]
	S1 --> S2[Store application name, allocate empty list]
	S2 --> S3[Construct clsMSOracleDataLayer with user CLM]
	S3 --> S4[Obtain IDataPortalInfo]
	S4 --> S5[PreferenceData.GetPreferencesForUser]
	S5 --> S6[Store result in _Preferences]
	S6 --> EndOk([In-memory preference set ready])
```

## Failure and edge-case behavior
- No explicit error handling exists in `Load()` itself; an exception from the data layer or the framework preference service propagates unhandled to the caller.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **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.

## Sources
- `SAIF.Presentation/clsPreferences.vb`
