---
title: Delete a manual class base with referential guard
summary: `clsManualClassBase.CanDeleteManualClassBaseRecord` then `BeforeDelete`/`AfterDelete` (`clsManualClassBase.vb:1341-1383`, `:889-910`)
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Rating
reference_type: package
operation_id: OP-006
trigger: Rate-file maintenance wants to remove a manual class from a rate file
---

# Delete a manual class base with referential guard

`clsManualClassBase.CanDeleteManualClassBaseRecord` then `BeforeDelete`/`AfterDelete` (`clsManualClassBase.vb:1341-1383`, `:889-910`)

| Field | Value |
| --- | --- |
| **Operation ID** | OP-006 |
| **Trigger** | Rate-file maintenance wants to remove a manual class from a rate file |
| **Inputs** | Manual class number, WCIS rate file sequence number |
| **Outputs** | Boolean eligibility, then the delete itself |
| **Primary components** | ``clsManualClassBase.CanDeleteManualClassBaseRecord` then `BeforeDelete`/`AfterDelete` (`clsManualClassBase.vb:1341-1383`, `:889-910`)` |
| **Entry point** | `Business\SAIF.Business.Policy.Rating\clsManualClassBase.vb` |

## Steps

1. Execute the scalar probe
2. If the count is greater than zero, return `False` — the class is in use by a premium history set
3. Any exception during the probe is wrapped and rethrown as
4. If eligible, `BeforeDelete` sets `SQLStatement = MyCriteria.DeleteSQL`, `RequestType = NonQuery`,
5. `AfterDelete` reads `RowsAffected`; when it is not exactly 1 it calls
6. Use the related data-access statements and tables for this operation: [SQL-017](../sql/SQL-017-saif-business-policy-rating.md), [SQL-056](../sql/SQL-056-saif-business-policy-rating.md), [PREM_HIST_CLASS_COVERAGE](../database-tables.md#prem_hist_class_coverage), [MANUAL_CLASS_BASE](../database-tables.md#manual_class_base).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
  Start([Trigger: remove a manual class from a rate file]) --> S1[Execute scalar probe: premium history usage count]
  S1 --> D1{Count greater than 0?}
  D1 -->|Yes| S2[Return False - class in use by a premium history set]
  D1 -->|No| S3[Eligible: BeforeDelete sets DeleteSQL, RequestType=NonQuery]
  S3 --> S4[Execute delete; AfterDelete reads RowsAffected]
  S4 --> D2{RowsAffected equals 1?}
  D2 -->|Yes| S5[Delete confirmed]
  D2 -->|No| S6[Raise error - unexpected row count]
  S1 -.->|Exception during probe| S7[Wrapped and rethrown]
  S2 --> Done([Result: not eligible])
  S5 --> Done2([Result: deleted])
  S6 --> Done2
  S7 --> Done2
```

## Failure and edge-case behavior
- Review the linked business rules and SQL documents for the validation or data-access conditions that can block this operation.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **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
- `Business\SAIF.Business.Policy.Rating\clsManualClassBase.vb`
