---
title: "SQL-380: Delete EdiFile via DeleteFile"
summary: Delete operation against EdiFile via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-380: Delete EdiFile via DeleteFile

This statement deletes the `EdiFile` entity identified by its identifier (`ID`) via `IUnitOfWork.GetRepository<T>().Delete(entity)`, invoked from `EdiFileService.DeleteFile` (`Services/SAIF.Services/Utilities/Edi/EdiFileService.cs:77`). The file's segment children cascade-delete via the mapping. The SQL below is inferred from this repository call and the `EdiFile` NHibernate mapping — it is not literal SQL present in source.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-380 |
| **Operation type** | Delete |
| **Execution method** | ORM (IRepository.Delete) |
| **Database** | Oracle |
| **Schema** | OPS$JIMMIL |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `EdiFile` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `DeleteFile` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | long | N/A | Identifier of the EdiFile being deleted (`ID`) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EDI_FILE](../database-tables.md#edi_file) | DELETE | `ID` |

## LINQ statement

Source: `Services/SAIF.Services/Utilities/Edi/EdiFileService.cs:77`

```csharp
// Services/SAIF.Services/Utilities/Edi/EdiFileService.cs:77
unitOfWork.GetRepository<DataModel.EdiFile>().Delete(file);
```

## 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
DELETE FROM OPS$JIMMIL.EDI_FILE
WHERE ID = :Id
```

Translation notes:

- `Schema("OPS$JIMMIL")` (line 11) qualifies the table.
- `HasMany(x => x.Segments).KeyColumn("FILE_ID").Cascade.AllDeleteOrphan().Inverse()` (lines 20-22) - deleting the file cascades deletes to its segment children; those statements are not fabricated.
- Entity loaded at line 74 (separate read).

## Operations and processes
- EdiFileService.DeleteFile — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Utilities/Edi/EdiFileService.cs (L77)`
