---
title: LegalQueryProvider
summary: API reference for LegalQueryProvider.
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# LegalQueryProvider

Query provider exposing 15 data-access operation(s) (`GetActiveLegalCases`, `GetAdpEmployeeName`, `GetAppealAssignedAttorney`, `GetAttorneyProfile`, `GetCaseCost`, `GetClaimIdForCase` and 9 more) against 13 distinct table(s); see [sql/index.md](../../sql/index.md) for the full ORM operation catalog.

## Purpose
- Provides read/write access to 13 table(s) via NHibernate `IQueryable<T>`/`GetRepository<T>()` calls documented in [sql/index.md](../../sql/index.md).
- Exposes 15 public query/command method(s) consumed by higher application layers; see [database-tables.md](../../database-tables.md) for the underlying schema.

## Context
- Namespace: `SAIF.Data.Queries.Legal`
- Assembly/package: `SAIF.Data`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| GetLegalCase | `LegalCase GetLegalCase(long id)` | Executes an ORM query ([SQL-152](../../sql/SQL-152-legal-query-provider-get-legal-case.md)) against [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetLegalCases | `IEnumerable<LegalCase> GetLegalCases(long claimId)` | Executes an ORM query ([SQL-153](../../sql/SQL-153-legal-query-provider-get-legal-cases.md)) against [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetClaimIdForCase | `long GetClaimIdForCase(string claimNumOrCaseNumber)` | Executes an ORM query ([SQL-154](../../sql/SQL-154-legal-query-provider-get-claim-id-for-case.md)) against [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetCaseCost | `IEnumerable<CaseCost> GetCaseCost(long caseId)` | Executes an ORM query ([SQL-155](../../sql/SQL-155-legal-query-provider-get-case-cost.md)) against [CASE_COST](../../database-tables.md#case_cost), [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetLegalBills | `IEnumerable<LegalBill> GetLegalBills(long caseId)` | Executes an ORM query ([SQL-156](../../sql/SQL-156-legal-query-provider-get-legal-bills.md)) against [LEGAL_BILL](../../database-tables.md#legal_bill), [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetSubpoenas | `IEnumerable<Subpoena> GetSubpoenas(long caseId)` | Executes an ORM query ([SQL-157](../../sql/SQL-157-legal-query-provider-get-subpoenas.md)) against [SUBPOENA](../../database-tables.md#subpoena), [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetAppealAssignedAttorney | `String GetAppealAssignedAttorney(long caseId)` | Executes an ORM query ([SQL-158](../../sql/SQL-158-legal-query-provider-get-appeal-assigned-attorney.md)) against [APPEAL](../../database-tables.md#appeal), [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetAdpEmployeeName | `String GetAdpEmployeeName(string emplId)` | Executes an ORM query ([SQL-159](../../sql/SQL-159-legal-query-provider-get-adp-employee-name.md)) against [`Employee` (SAIF.Framework mapping; table unknown**)](../../database-tables.md#employee). |
| GetActiveLegalCases | `IEnumerable<LegalCase> GetActiveLegalCases(long claimId)` | Executes an ORM query ([SQL-160](../../sql/SQL-160-legal-query-provider-get-active-legal-cases.md)) against [LEGAL_CASE](../../database-tables.md#legal_case), [CASE_STATUS_CODE](../../database-tables.md#case_status_code). |
| GetAttorneyProfile | `AttorneyProfile GetAttorneyProfile(string attorneyEmployeeId)` | Executes an ORM query ([SQL-161](../../sql/SQL-161-legal-query-provider-get-attorney-profile.md)) against [ATTORNEY_PROFILE](../../database-tables.md#attorney_profile). |
| GetOtherFirm | `OtherFirm GetOtherFirm(long id)` | Executes an ORM query ([SQL-162](../../sql/SQL-162-legal-query-provider-get-other-firm.md)) against [OTHER_FIRM](../../database-tables.md#other_firm). |
| GetLegalPerson | `LegalPerson GetLegalPerson(long id)` | Executes an ORM query ([SQL-163](../../sql/SQL-163-legal-query-provider-get-legal-person.md)) against [LEGAL_PERSON](../../database-tables.md#legal_person). |
| GetLegalPersonAddress | `LegalPersonAddress GetLegalPersonAddress(long id, string addressTypeCode)` | Executes an ORM query ([SQL-164](../../sql/SQL-164-legal-query-provider-get-legal-person-address.md)) against [LEGAL_PERSON_ADDRESS](../../database-tables.md#legal_person_address), [LEGAL_PERSON](../../database-tables.md#legal_person), [ADDRESS_TYPE_CODE](../../database-tables.md#address_type_code). |
| IsPrimaryCase | `bool IsPrimaryCase(long caseId)` | Executes an ORM query ([SQL-165](../../sql/SQL-165-legal-query-provider-is-primary-case.md)) against [CONSOLIDATED_CASE](../../database-tables.md#consolidated_case), [LEGAL_CASE](../../database-tables.md#legal_case). |
| IsImageAlertNeeded | `bool IsImageAlertNeeded(long claimId)` | Executes an ORM query ([SQL-166](../../sql/SQL-166-legal-query-provider-is-image-alert-needed.md)) against [LEGAL_CASE](../../database-tables.md#legal_case). |
| GetFinancialTransaction | `FinancialTransaction GetFinancialTransaction(long claimId, string invoiceNumber)` | Retrieves financial transaction.* |
| GetLegalBillFinancialTransaction | `FinancialTransaction GetLegalBillFinancialTransaction(long billId, long claimId)` | Retrieves legal bill financial transaction.* |
| GetSubpoenaFinancialTransaction | `FinancialTransaction GetSubpoenaFinancialTransaction(long subpoenaId, long recipientId, long claimId)` | Retrieves subpoena financial transaction.* |
| LegalQueryProvider(IRepositoryFactory factory, ICCClaimApiService ccclaimApiService, IClaimDataApiClient gwclaimDataApiClient) | `LegalQueryProvider(IRepositoryFactory factory, ICCClaimApiService ccclaimApiService, IClaimDataApiClient gwclaimDataApiClient)` | Initializes a new instance, wiring the repository factory used by this provider's query methods.* |

## Behavioral notes
- Query methods build LINQ expressions over `IQueryable<T>` obtained via `Factory.GetRepository<T>()` and execute them against the underlying NHibernate session.*

## Constraints and usage notes
- Instances are constructed with an `IRepositoryFactory` and are expected to be resolved through dependency injection rather than instantiated directly.*

> **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
- `Data/SAIF.Data/Queries/Legal/LegalQueryProvider.cs`
