Skip to content

Navigate with a fresh model

A variant of Navigate to a view that first builds an entirely new model and view-data instance — used when a screen needs to open a logically independent window (for example, a second claim window) rather than reuse the current model.

Field Value
Operation ID OP-MVC-04b
Trigger Derived controller opens a new logical window/instance under multi-model support
Inputs SupportsMultiModel, factory-built model, current ViewData
Outputs New model/view data stored under a new GUID in session; delegates to Navigate
Primary components clsControllerBase.Navigate2
Entry point SAIF.Presentation.Web.MVC/clsControllerBase.vb

Steps

  1. If SupportsMultiModel is false, throw ApplicationException("Navigate2 only supported with Multiple Model configuration.") (BR-MVC-011).
  2. On failure: exception propagates to the caller — no model/context is created.
  3. Build a new model from the factory, assign a new clsSecurityPrincipal(Platform.Web) and the application name, and call Pre_Init().
  4. Call the overridable OnNewModel(newModel, newViewData).
  5. If it returns False: abandon the navigation and return False — no session state is written and Navigate is not called.
  6. Copy all current ViewData entries into the new view data, call newModel.UnInitialize(), and store both under a new GUID (<guid>-model, <guid>-viewdata) in session (BR-MVC-008).
  7. Delegate to Navigate(...) passing the new GUID as inNewModel.
  8. Embeds Navigate to a view, including its cross-application context persistence to Context via SQL-001.

Origin: Step 5 is implemented in Navigate to a view (clsControllerBase.Navigate, this library) and executed on behalf of this operation.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Navigate2 called]) --> D1{SupportsMultiModel?}
    D1 -->|No| EndErr([Throw ApplicationException])
    D1 -->|Yes| S1[Build new model, new SecurityPrincipal, Pre_Init]
    S1 --> S2[OnNewModel]
    S2 --> D2{Returned False?}
    D2 -->|Yes| EndAbandon([Return False])
    D2 -->|No| S3[Copy ViewData, UnInitialize old, store under new GUID]
    S3 --> S4[Delegate to Navigate]
    S4 --> EndOk([Navigate result returned])

Failure and edge-case behavior

  • Calling this operation without multi-model support enabled is a hard configuration error (ApplicationException), not a silent no-op.
  • A derived OnNewModel override can veto the navigation entirely by returning False, before any session state changes are made.

Sources

  • SAIF.Presentation.Web.MVC/clsControllerBase.vb