Project web context onto the view model¶
Copy the resolved web context onto the current view model after the action executes. Trigger: MVC action-filter pipeline, after the action result is produced.
| Field | Value |
|---|---|
| Operation ID | OP-02 |
| Trigger | MVC action-filter pipeline, after the action result is produced |
| Inputs | filterContext.Controller.ViewData.Model, resolved WebContext |
| Outputs | WebContextViewModelBase.WebContext.ContextId / .ContextValue populated |
| Primary components | WebContextControllerBase.OnActionExecuted(ActionExecutedContext) |
| Entry point | src/Web.Mvc/Controllers/WebContextControllerBase.cs |
Steps¶
- Cast
ViewData.ModeltoWebContextViewModelBase; a null cast result means the model does not participate in web context and the step is skipped (BR-06). - If both the model and
WebContextare non-null, copyWebContext.ContextIdintomodel.WebContext.ContextIdandWebContext.CurrentValueintomodel.WebContext.ContextValue. - Call
base.OnActionExecuted(filterContext).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Action result produced])
Cast[Cast ViewData.Model to WebContextViewModelBase]
Chk{Model and WebContext non-null?}
Copy[Copy ContextId/ContextValue]
Skip([Skip decoration])
EndOk([Continue])
Start --> Cast
Cast --> Chk
Chk -->|Yes| Copy
Chk -->|No| Skip
Copy --> EndOk
Skip --> EndOk
Failure and edge-case behavior¶
- No unexpected failure paths beyond argument-guard exceptions and delegated dependency behavior were identified for this operation.
Related documentation¶
Sources¶
src/Web.Mvc/Controllers/WebContextControllerBase.cs