Receive inbound cross-application context¶
The receiving side of the cross-application hand-off. When a request arrives with a referrer from a different SAIF application, this operation reads and consumes the context rows that application saved, applies them through the derived screen's HandleContext hook, and completes any deferred navigation.
| Field | Value |
|---|---|
| Operation ID | OP-MVC-05 |
| Trigger | Step 10 of Initialize a request, when a referrer exists |
| Inputs | Referrer path, current request path |
| Outputs | Applied context via the derived HandleContext; a possible immediate Navigate |
| Primary components | clsControllerBase.CheckContext |
| Entry point | SAIF.Presentation.Web.MVC/clsControllerBase.vb |
Steps¶
- Extract the source application from the referrer path and the current application from the request path.
- If they differ, call
Model.Context.RetrieveContext(sourceApp, currentApp, Session.SessionID)(BR-MVC-010, BR-MVC-017). - Embeds Retrieve and consume context rows:
SELECTthe source application's rows (SQL-002, Context), thenDELETEthem so the hand-off is single-use (SQL-004).
Origin: Step 2's retrieval and deletion are implemented in
Retrieve and consume context rows(clsContext.RetrieveContext, this library) and executed on behalf of this operation. - If the applications match (no cross-app referrer): no context processing occurs for this request. 3. If any values were returned, call the derivedHandleContext(values)so the screen applies them. 4. If the returned values contain a non-emptytargetView, immediately call Navigate to a view with(targetApp, targetView)— completing a deferred navigation initiated by the source application (BR-MVC-010). - IftargetViewis empty: no further navigation occurs; the request continues rendering the current view with the applied context.
Also called from clsContext.GetPID in the context of resolving a returning __SAIFPID view ID via SQL-003, used to rejoin a request to the correct multi-model instance (BR-MVC-008).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([CheckContext referrer]) --> D1{Source app <> current app?}
D1 -->|No| EndSkip([No context processing])
D1 -->|Yes| S1[RetrieveContext: SELECT then DELETE rows]
S1 --> D2{Values returned?}
D2 -->|No| EndNone([Continue rendering])
D2 -->|Yes| S2[Derived HandleContext applies values]
S2 --> D3{targetView present?}
D3 -->|Yes| S3([Navigate to targetApp/targetView])
D3 -->|No| EndOk([Continue rendering current view])
Failure and edge-case behavior¶
- Retrieval failures inside the repository are wrapped as
ApplicationException("Context Repository Retrieve Failed.")after being traced (see Retrieve and consume context rows). - Because rows are deleted immediately after retrieval, a refresh of the receiving page cannot replay the same hand-off.
Related documentation¶
Sources¶
- SAIF.Presentation.Web.MVC/clsControllerBase.vb
- SAIF.Presentation.Web.MVC/clsContext.vb