Initialize the web context service for a session¶
Set up the session-backed context dictionary and cached endpoint URL on first resolution in a session. Trigger: Autofac InstancePerRequest resolution of IWebContextService.
| Field | Value |
|---|---|
| Operation ID | OP-15 |
| Trigger | Autofac InstancePerRequest resolution of IWebContextService |
| Inputs | IEnvironmentService |
| Outputs | Session-backed context dictionary and cached service URL |
| Primary components | WebContextService constructor |
| Entry point | src/Web/WebContextService.cs |
Steps¶
- Read
HttpContext.Current.Session. - When
Session["WebContextRepository"]is null, create a newDictionary<string, IWebContext>there (BR-32). - When
Session["ContextServiceUrl"]is null, populate it fromenvironmentService.GetConfigSetting(EnvironmentConfigKeys.WebContextServiceUrl)— the endpoint is resolved once per session, not per request (BR-33). - Assign the session dictionary to
itemsand the URL toserviceUrl.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([IWebContextService resolved])
Session[Read HttpContext.Current.Session]
Repo{WebContextRepository present?}
InitRepo[Create session dictionary]
Url{ContextServiceUrl present?}
InitUrl[Resolve webContextServiceUrl setting]
EndOk([Constructor complete])
Start --> Session
Session --> Repo
Repo -->|No| InitRepo
Repo -->|Yes| Url
InitRepo --> Url
Url -->|No| InitUrl
Url -->|Yes| EndOk
InitUrl --> 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/WebContextService.cs