Skip to content

OP-009: Retrieve and consume a stored web context

Get is invoked over the WebContext route on SAIF.Services.WCF.Services.WebContextService; this page documents the process end to end, from route dispatch to the message the caller receives.

Field Value
Operation ID OP-009
Trigger Caller invokes Get over the WebContext route.
Entry operation Get
Owning component SAIF.Services.WCF.Services.WebContextService.Get
Inputs Request message parts listed below
Outputs The web context for the given application and session, then destroyed.
Failure behavior Generic SOAP fault, per Faults and error pipeline

Request and response

Direction Element Type Declared in Notes
Request applicationName string BCL (System) Application name portion of the context key. (Yes)
Request sessionId string BCL (System) Session id portion of the context key. (Yes)
Response IWebContext IWebContext External contracts assembly (SAIF.Services.WCF.Contracts / framework closure) ** The web context for the given application and session, then destroyed.

Steps

  1. Constructor resolves the SQL Server NETFRAMEWORK/APPM connection and opens a unit of work plus a Repository<WebContextItem> (BR-WCF-002).
  2. Enforce.ArgumentNotNullOrEmpty on applicationName and sessionId (BR-WCF-014).
  3. On failure: ArgumentNullException, logged and surfaced as a generic SOAP fault.
  4. Query all WebContextItem rows for the application and session into a list, outside the unit of work.
  5. Find the item named __SAIFPID; pass its value (or null) to CreateContext, which seeds the context id from that value or generates a new GUID (BR-WCF-015).
  6. unitOfWork.Begin() opens the boundary for the delete loop.
  7. For each item: copy it into the context unless its name is one of sourceApp, sourceView, targetApp, targetView (BR-WCF-016), then repository.Delete(x) unconditionally — including the excluded names and __SAIFPID (BR-WCF-017).
  8. unitOfWork.Commit(); return the context.
  9. On failure: logged by the installed error handler, surfaced as a generic SOAP fault; the transaction rolls back on Dispose, so the read items survive and the read is not idempotent across a failure.*

Process flow

The following diagram visualizes this process's control flow.

flowchart TD
    A["Resolve SQL connection and<br>open Repository&lt;WebContextItem&gt;"]
    B["Validate applicationName and sessionId"]
    C["Query stored context items for<br>application and session"]
    D1{"__SAIFPID item present?"}
    D2["Seed the context id from<br>the __SAIFPID item's value"]
    D3["Generate a new GUID<br>for the context id"]
    D["CreateContext constructs the context<br>with the seeded or generated id"]
    E["Begin transaction for delete loop"]
    F1{"Item name is one of<br>sourceApp, sourceView,<br>targetApp, targetView?"}
    F2["Excluded: do not copy<br>the item into the context"]
    F3["Not excluded: copy the<br>item into the context"]
    F4["repository.Delete(x) unconditionally —<br>including the excluded names and __SAIFPID"]
    G["unitOfWork.Commit(); return the context."]
    A --> B
    B --> C
    C --> D1
    D1 -->|"Present"| D2
    D1 -->|"Absent"| D3
    D2 --> D
    D3 --> D
    D --> E
    E --> F1
    F1 -->|"Yes"| F2
    F1 -->|"No"| F3
    F2 --> F4
    F3 --> F4
    F4 --> G

Transaction and side effects

Aspect Finding
Unit of work SqlServerUnitOfWorkFactory (NETFRAMEWORK/APPM)
Commit point unitOfWork.Commit() after the delete loop
Records written WebContextItem (read, then deleted)
Downstream calls None
Shared state touched None
Repeat-call behavior A repeat call after a successful Get returns a fresh context because the rows were deleted

Logging

Surface Written content
ErrorLogErrorHandler → LogService Failure-path exception logging only, carrying method signature, calling user and exception detail; see Faults and error pipeline

Faults and error handling

Failure Fault type the caller receives Produced by Source
ArgumentNullException Generic SOAP fault The operation itself, via Enforce src/WCF/SAIF.Services.WCF.Host/Services/WebContextService.cs
SQL Server/NHibernate exception Generic SOAP fault The ErrorLogErrorHandler installed by [LogErrorBehavior] src/WCF/SAIF.Services.WCF.Host/Services/WebContextService.cs

Authorization

Requirement Enforced by Source Applies to
None in code IIS authentication on the deployment (see Activation and hosting) src/WCF/SAIF.Services.WCF.Host/Services/WebContextService.cs This operation

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • src/WCF/SAIF.Services.WCF.Host/Services/WebContextService.cs