Retrieve and consume context rows¶
Implements the read-then-delete pattern that makes cross-application context hand-off single-use: the destination application reads the source application's rows and immediately deletes them, so a page refresh cannot replay a completed hand-off.
| Field | Value |
|---|---|
| Operation ID | OP-MVC-07 |
| Trigger | Called by Receive inbound cross-application context |
| Inputs | Source app, current app, session ID |
| Outputs | Hashtable of context values; source rows deleted |
| Primary components | clsContext.RetrieveContext |
| Entry point | SAIF.Presentation.Web.MVC/clsContext.vb |
Steps¶
- Create a
clsContextRepositoryand callRetrieve(sourceApp, currentApp, sessionID)— a parameterizedSELECToverContextfiltered byAppName,SessionID, and excluding the current application (SQL-002, Context). - Copy each row's
ContextName/ContextValueinto a hashtable. - Call
CtxRep.Delete(sourceApp, sessionID)so context is consumed exactly once (SQL-004, BR-MVC-017). - Return the hashtable.
- On failure: repository failures are wrapped as
ApplicationException("Context Repository Retrieve Failed.", ex)after being traced.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([RetrieveContext]) --> S1[SELECT rows for sourceApp/session, excluding currentApp]
S1 --> S2[Copy ContextName/ContextValue pairs into hashtable]
S2 --> S3[DELETE the source app's rows]
S3 --> EndOk([Return hashtable])
S1 -.->|Exception| EndErr([Wrap as ApplicationException])
S3 -.->|Exception| EndErr
Failure and edge-case behavior¶
- A retrieval or delete failure at any step is wrapped as
ApplicationException("Context Repository Retrieve Failed.", ex), preserving the original exception as the inner exception. - Because the delete always follows the select within the same call, an abandoned navigation that never completes its retrieve simply leaves rows behind rather than corrupting state — no cleanup job for stale rows exists in this repository.**
Related documentation¶
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Sources¶
- SAIF.Presentation.Web.MVC/clsContext.vb