---
title: PrefScope
summary: API reference for PrefScope.
status: draft
owner: SAIF Documentation Team
last_reviewed: 2026-08-17
library: SAIF.Presentation
reference_type: package
---

# PrefScope

`PrefScope` is the contract consumers use to select the storage granularity of a preference key on every `clsPreferences` read or write. Its three members determine whether a preference key is scoped to the whole application or a specific page; `WebLevel` omits the page component but is still filtered by `m_Application`, so in the current implementation it remains scoped to the current application rather than sharing preferences globally across the web tier, and is behaviorally equivalent to `AppLevel`*. All three members directly control which `Preference` group `clsPreferences` searches or mutates ([BR-PREF-001](../../business-rules.md#br-pref-001-preference-scoping-by-application-and-page)).

## Purpose
- Define the scope boundary — application-level, page-level, or web-level (application-scoped without a page component) — at which a preference key is stored and retrieved by `clsPreferences`.
- Drive the internal `PageKey(scope)` calculation in `clsPreferences`, which returns the current page name only for `PageLevel` scope and an empty string otherwise, determining group matching for all `Item`/`Add`/`Remove`/`Clear` calls.

## Context
- Namespace: `SAIF.Presentation`
- Assembly/package: `SAIF.BOF.Presentation.Web.Infragistics103` (NuGet package; this project's `.vb` source is bundled and recompiled by consumers rather than shipped as a compiled binary)*

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `AppLevel` | `PrefScope.AppLevel` | Scopes a preference to the current application, independent of page — used, for example, by `SAIFMenu` to persist the `SHOWAPPS` menu preference across all pages of an application*. |
| `PageLevel` | `PrefScope.PageLevel` | Scopes a preference to the current application and the current page (the default scope used by the single-argument `Item` and `Add` overloads); the page identity is derived from the web request path or a stack-trace/override fallback in non-web contexts. |
| `WebLevel` | `PrefScope.WebLevel` | Omits the page identity from the key (`PageKey` returns an empty string for this scope), but the preference lookup is still filtered by `m_Application`, so it remains scoped to the current application rather than shared globally across applications; in the current implementation it is behaviorally equivalent to `AppLevel`*. |

## Behavioral notes
- `PageKey(scope)` treats `AppLevel` and `WebLevel` identically for key derivation (both yield an empty-string page component); the practical distinction between the two scopes in the current implementation may rely only on convention/caller discipline rather than enforced separation*.

## Constraints and usage notes
- Callers must select the correct `PrefScope` deliberately: because reads/writes on the `Item` indexer default to `PageLevel`, code intending an application-wide or web-wide setting must always pass the scope explicitly.

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