---
title: SubpoenaMappingHelper
summary: API reference for SubpoenaMappingHelper.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SubpoenaMappingHelper

A static AutoMapper configuration holder that registers every type mapping the subpoena services rely on to translate between EF data-model entities (`SAIF.Data.Model.Legal.Subpoenas`, `SAIF.Data.Model.Legal`, `SAIF.Data.Model.Providers`, `SAIF.Data.Model.Locations`), the domain `InjuryClaim`/`Worker` model, and the outward-facing contract DTOs (`SAIF.Core.Contracts.Legal.Subpoenas`, `SAIF.Core.Contracts.Legal`, `SAIF.Core.Contracts.Providers`, `SAIF.Core.Contracts.Locations`). `MapSubpoenaService()` is invoked once from static constructors of `SubpoenaService` and `SubpoenaPaymentService` to register these mappings before any instance method executes.

## Purpose
- Registers reversible code-table mappings (hearing-location codes, special-handling, status, and type codes) between data and contract models.
- Registers supporting-table mappings, including composing an attorney's display `Name` from last/preferred-or-first name and mapping locations to their contract representation.
- Registers the primary entity mappings: hearing location (with computed `FullLocationName`/`FormattedAddress`), `Subpoena`→contract `Subpoena` (including case-number fallback chain and appearance date/time split), `InjuryClaim`→`Subpoena` overlay, `Recipient`→`SubpoenaRecipient` (with resolved provider/registered-agent/policy names and formatted addresses), `LegalPerson`/`LegalPersonAddress`→contract equivalents, provider-location, `Subpoena`/`InjuryClaim`→`SubpoenaInboxItem`, registered agent, and process server.
- Provides the single `MapSubpoenaService()` entry point that runs all three mapping-registration groups in order.

## Context
- Namespace: `SAIF.Services.Legal.Subpoenas`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package).

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| MapCodeTables | `public static void MapCodeTables()` | Registers two-way (`ReverseMap`) AutoMapper maps for `HearingLocationCode`, `SubpoenaSpecialHandling`, `SubpoenaStatus`, and `SubpoenaType` between data and contract representations. |
| MapSupportingTables | `public static void MapSupportingTables()` | Registers the `AttorneyProfile`→`LegalEmployee` map (building `Name` from last name plus preferred-or-first name, and copying `AttorneyEmployeeId`/`UserId`) and the `Location`→contract `Location` map. |
| MapTables | `public static void MapTables()` | Registers all primary subpoena-domain entity mappings — hearing location, subpoena, injury claim overlay, recipient, legal person/address, provider location, inbox item, registered agent, and process server — computing derived fields such as full location name, case-number fallback (`WcbNumber`??`DcbsNumber`??`BrbNumber`??`OaljNumber`??`OwcpNumber`??claim number), formatted addresses, and witness display name/address via the private `GetFormattedWitnessName`/`GetFormattedWitnessAddress`/`GetFormattedPolicyAddress` resolvers. |
| MapSubpoenaService | `public static void MapSubpoenaService()` | Runs `MapCodeTables()`, `MapSupportingTables()`, and `MapTables()` in sequence to fully configure AutoMapper for the subpoena services; called once per process from the static constructors of `SubpoenaService` and `SubpoenaPaymentService`. |

## Behavioral notes
- Carries `CA1053:StaticHolderTypesShouldNotHaveConstructors` (class-level) and, on `MapTables`, `CA1502:AvoidExcessiveComplexity`/`CA1506:AvoidExcessiveClassCoupling` suppressions, reflecting its role as a large, static-only mapping configuration surface.
- Registers mappings globally on the static AutoMapper `Mapper` class rather than a scoped `IMapper` instance, so repeated calls re-register (rather than replace) the same maps for the lifetime of the process.*
- The `Subpoena`→contract `Subpoena` and `InjuryClaim`→`SubpoenaInboxItem`/`Subpoena` maps default `CaseNumber` to the claim number only when the primary case-number fallback chain resolves to an empty string.

## Constraints and usage notes
- All members are static; the class is a pure configuration holder and is never instantiated by calling code.*
- Callers must ensure `MapSubpoenaService()` (or the individual `Map*` methods) has run before invoking any AutoMapper `Mapper.Map` call against the types it registers, or mapping will fail/produce empty results.*

> **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
- `Services/SAIF.Services/Legal/Subpoenas/SubpoenaMappingHelper.cs`
