---
title: "SQL-178: MedicareQueryProvider.GetCountforBatchOfMedicareBeneficiary"
summary: Read operation for `MedicareQueryProvider.GetCountforBatchOfMedicareBeneficiary`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-178: MedicareQueryProvider.GetCountforBatchOfMedicareBeneficiary

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `MedicareQueryProvider.GetCountforBatchOfMedicareBeneficiary`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-178 |
| **Operation type** | Read |
| **Execution method** | ORM (NHibernate LINQ) |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `MedicareQueryProvider` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `GetCountforBatchOfMedicareBeneficiary` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `submissionDate` | Input | DateTime | N/A | Method argument of `MedicareQueryProvider.GetCountforBatchOfMedicareBeneficiary` bound into the ORM expression; NHibernate generates the bind variable at runtime |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [MEDICARE_BENEFICIARY_QUERY](../database-tables.md#medicare_beneficiary_query) | SELECT (aggregate) | SUBMISSION_DATE |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:49`. The repository/queryable is initialised at `Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:18`.

```csharp
// Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:18
medicareBeneficiaryRepository = factory.GetRepository<MedicareBeneficiaryQuery>().Query();

// Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:49
public int GetCountforBatchOfMedicareBeneficiary(DateTime submissionDate)
{
    return medicareBeneficiaryRepository.Count(x => x.SubmissionDate == submissionDate);
}
```

## Sample SQL

> **Inferred SQL:** This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT COUNT(*)
FROM MEDICARE_BENEFICIARY_QUERY MBQ
WHERE MBQ.SUBMISSION_DATE = :submissionDate
```

Translation notes:
- `Count(predicate)` → server-side `COUNT(*)`. The result is cast to `int`.

## Operations and processes

- [Other query providers](../operations/other-query-providers.md)

## Business rules

- [SD-BR-095 Medicare history match requires all fields equal](../business-rules.md#sd-br-095-medicare-history-match-requires-all-fields-equal)

## Sources
- `Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:49`
