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

# SQL-029: Create EdiFile via LoadFile

This ORM statement performs a create operation on `EdiFile` via `LoadFile`, executed from `Services/SAIF.Services/Utilities/Edi/EdiFileService.cs` (L64).

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-029 |
| **Operation type** | Create |
| **Execution method** | ORM (IRepository.Add) |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `EdiFile` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `LoadFile` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | `long` | N/A | Identifier from `EDI_FILE_SEQ.NEXTVAL` |
| `:Description` | Input | `string` | N/A |  |
| `:CreateDate` | Input | `DateTime` | N/A |  |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [OPS$JIMMIL.EDI_FILE](../database-tables.md#edi_file) | INSERT | ID, DESCRIPTION, CREATE_DATE (identifier from sequence `EDI_FILE_SEQ.NEXTVAL`) |

## LINQ statement

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

```csharp
// Services/SAIF.Services/Utilities/Edi/EdiFileService.cs:64
unitOfWork.GetRepository<DataModel.EdiFile>().Add(dfile);
```

## 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 EDI_FILE_SEQ.NEXTVAL
FROM DUAL

INSERT INTO OPS$JIMMIL.EDI_FILE (
  ID,
  DESCRIPTION,
  CREATE_DATE)
VALUES (
  :Id,
  :Description,
  :CreateDate)
```

Translation notes:
- `:Id` is the value fetched from sequence `EDI_FILE_SEQ` (`GeneratedBy.Native("EDI_FILE_SEQ")`) before the INSERT; NHibernate assigns it to `EdiFile.Id`.
- Cascade: `HasMany(x => x.Segments)` is mapped with `Cascade.AllDeleteOrphan()`; any transient instances in that association are saved in their own statements (not fabricated here).
- The mapping declares `Schema("OPS$JIMMIL")` (an individual Oracle OPS$ account schema), so the INSERT targets `OPS$JIMMIL.EDI_FILE`. This is recorded as-is from the mapping.

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

> **Note:** Statements marked with `**` could not be confirmed; treat as unknown until verified.

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