Get a web context by id (session-cache first)¶
Return a cached web context by id, recreating it remotely on a cache miss. Trigger: OP-01 (resolve web context) step 4.
| Field | Value |
|---|---|
| Operation ID | OP-04 |
| Trigger | OP-01 (resolve web context) step 4 |
| Inputs | contextId |
| Outputs | IWebContext |
| Primary components | WebContextService.Get(string contextId) |
| Entry point | src/Web/WebContextService.cs |
Steps¶
Enforce.ArgumentNotNullOrEmpty(contextId, "contextId")— throws on null/empty (BR-01).- Look the id up in the session dictionary
items; return the cached instance when present (BR-10). - On cache miss, fall through to
CreateContext(contextId)(OP-03) — a miss recreates the context remotely rather than failing.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Get by id])
Guard[Guard contextId not null/empty]
Chk{In session cache?}
Cached([Return cached instance])
Miss[Recreate via CreateContext]
EndOk([Return context])
Start --> Guard
Guard --> Chk
Chk -->|Yes| Cached
Chk -->|No| Miss
Miss --> EndOk
Cached --> EndOk
Failure and edge-case behavior¶
- Null or empty
contextIdthrows fromEnforce.
Related documentation¶
Sources¶
src/Web/WebContextService.cs