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

# PolicyModelExtensions

Small conversion helpers used by the policy page model: parse a posted string to a number and copy header values into the context.

## Purpose
- Turn the posted context text into a policy number ([BR-BOLMIDDLEWARE-008](../../business-rules.md#br-bolmiddleware-008-context-value-classification)).
- Keep the context in step with the loaded header ([BR-BOLMIDDLEWARE-011](../../business-rules.md#br-bolmiddleware-011-parent-account-derivation)).

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `ToLong` | `static long ToLong(this string value)` | Parses the text to a number and returns 0 when parsing fails. |
| `UpdateFromHeader` | `static void UpdateFromHeader(this ContextHelper helper, PolicyHeader header)` | Sets the policy number, agency number, and producer number on the context from the header. |

## Behavioral notes
- A zero result cannot be told apart from a failed parse.

## Constraints and usage notes
- `UpdateFromHeader` mutates the helper.

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