Cross-application context hand-off¶
When a user navigates into an application from a different SAIF application, this operation reads the context values the source application persisted to the shared Context table, merges them into the current request, consumes (deletes) them, and optionally continues navigation to a specific target view.
| Field | Value |
|---|---|
| Operation ID | OP-MVC-002 |
| Trigger | clsControllerBase.CheckContext(inAppPath), called from step 9 of Page/control lifecycle initialization when Request.UrlReferrer is present |
| Inputs | Referring URL path, current session ID |
| Outputs | Merged context values (via the abstract HandleContext hook), possible navigation |
| Primary components | clsControllerBase.CheckContext, clsContext.RetrieveContext, clsContext.clsContextRepository |
| Entry point | SAIF.Presentation.Web.MVC\clsControllerBase.vb |
Steps¶
- Derive
SourceAppNamefrom the referrer path andCurrentAppNamefrom the current request path. - If
SourceAppNameandCurrentAppNamediffer (case-insensitively) (BR-MVC-005), callModel.Context.RetrieveContext(SourceAppName, CurrentAppName, SessionID): - Executes SQL-MVC-002 against Context to select all rows for
SourceAppName/SessionIDthat do not already belong toCurrentAppName. - Immediately deletes the source application's rows via SQL-MVC-004 against Context — a read-then-consume pattern with no rowcount/contention validation.
- If any context values were returned, call the abstract
HandleContext(contextValues)hook. - This hook's concrete implementation lives entirely in the consuming application; no further step tracing is possible from this library alone.
- If a
targetViewcontext value is present among the retrieved values, call Cross-application navigation'sNavigate(targetApp, targetView)to redirect into the resolved destination.
Process flow¶
flowchart TD
Start([CheckContext called]) --> Compare{SourceApp <> CurrentApp?}
Compare -->|No| End([No hand-off; return])
Compare -->|Yes| Retrieve[RetrieveContext: SQL-MVC-002 SELECT]
Retrieve --> Delete[Delete source rows: SQL-MVC-004]
Delete --> HasValues{Any context values returned?}
HasValues -->|No| End
HasValues -->|Yes| HandleContext[HandleContext hook - concrete controller]
HandleContext --> TargetView{targetView value present?}
TargetView -->|Yes| Navigate([Navigate to target app/view])
TargetView -->|No| End
Failure and edge-case behavior¶
- No rowcount validation occurs before the delete step — if the read returns zero rows, the delete still executes (a no-op
DELETEwith no matching rows). HandleContextis an abstract (MustOverride) hook; if the concrete controller's implementation throws, the exception propagates up toViewPageBase.Page_Error→ Error handling.- ADO.NET failures inside
clsContextRepository.Retrieve/Deleteare wrapped in anApplicationExceptionwith a fixed message and the original exception preserved asInnerException.
Related documentation¶
Sources¶
- SAIF.Presentation.Web.MVC\clsControllerBase.vb
- SAIF.Presentation.Web.MVC\clsContext.vb