---
title: IWebContextService
summary: API reference for IWebContextService.
status: draft
owner: SAIF IT Core Services
last_reviewed: 2026-10-12
library: BolMiddleware
reference_type: package
---

# IWebContextService

Contract for reading, creating, and saving the BOL web context through the BOL Context API. `WebContextService` implements it.

## Purpose
- Provide context lookup by context id or by session and application, and context persistence ([BR-BOLMIDDLEWARE-001](../../business-rules.md#br-bolmiddleware-001-web-context-resolution-precedence)).

## Context
- Namespace: `BolMiddleware.Services.Context`
- Assembly/package: `BolMiddleware`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `SaveContext` | `bool SaveContext(ContextSaveRequest request)` | Persists the context and returns whether it succeeded. |
| `GetContext` | `ContextResult GetContext(string contextId)` | Fetches the context stored under a context id. |
| `GetContext` | `ContextResult GetContext(string sessionId, string applicationName)` | Fetches the latest context for the session and application. |
| `NewContext` | `ContextResult NewContext(string sessionId, string applicationName)` | Creates a fresh context for the session and application. |

## Behavioral notes
- Implementations swallow errors and return empty results ([BR-BOLMIDDLEWARE-021](../../business-rules.md#br-bolmiddleware-021-silent-failure-degradation)).

## Constraints and usage notes
- Registered as singleton.

## Sources
- src/BolMiddleware/Services/Context/IWebContextService.cs
