Skip to content

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

  1. Derive SourceAppName from the referrer path and CurrentAppName from the current request path.
  2. If SourceAppName and CurrentAppName differ (case-insensitively) (BR-MVC-005), call Model.Context.RetrieveContext(SourceAppName, CurrentAppName, SessionID):
  3. Executes SQL-MVC-002 against Context to select all rows for SourceAppName/SessionID that do not already belong to CurrentAppName.
  4. Immediately deletes the source application's rows via SQL-MVC-004 against Context — a read-then-consume pattern with no rowcount/contention validation.
  5. If any context values were returned, call the abstract HandleContext(contextValues) hook.
  6. This hook's concrete implementation lives entirely in the consuming application; no further step tracing is possible from this library alone.
  7. If a targetView context value is present among the retrieved values, call Cross-application navigation's Navigate(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 DELETE with no matching rows).
  • HandleContext is an abstract (MustOverride) hook; if the concrete controller's implementation throws, the exception propagates up to ViewPageBase.Page_Error → Error handling.
  • ADO.NET failures inside clsContextRepository.Retrieve/Delete are wrapped in an ApplicationException with a fixed message and the original exception preserved as InnerException.

Sources

  • SAIF.Presentation.Web.MVC\clsControllerBase.vb
  • SAIF.Presentation.Web.MVC\clsContext.vb