---
title: AuditedServiceOverrideService
summary: API reference for AuditedServiceOverrideService.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# AuditedServiceOverrideService

Implements `IAuditedServiceOverrideService`, providing CRUD access to EDI audited-service bypass overrides (records that let a specific billed service/service-type/modifier combination skip an EDI audit) via `IUnitOfWork`, stamping each write with the current user's ID from `IUserProfileService`. It also depends on `IValidationService`, though validation is not invoked in the methods shown.

## Purpose
- Retrieves a single audited-service override by billing/audit sequence ID, or all overrides.
- Adds, edits, and deletes audited-service overrides, each within its own transaction with rollback on failure.
- Stamps every write with the current user, current time, and an incremented update-number for optimistic-concurrency/audit purposes.

## Context
- Namespace: `SAIF.Services.Edi`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| AuditedServiceOverrideService(...) | `public AuditedServiceOverrideService(IUnitOfWork uow, IValidationService validationService, IUserProfileService userProfileService)` | Stores the unit of work, validation service, and user-profile collaborators (all required non-null) and captures the current user's ID for stamping subsequent writes. |
| Get(id, auditSequenceId) | `public Contract.AuditedServiceOverride Get(long id, long auditSequenceId)` | Returns the single audited-service override matching both `id` and `auditSequenceId`, mapped to the contract type; throws if no matching row exists. |
| Get() | `public IEnumerable<Contract.AuditedServiceOverride> Get()` | Returns every audited-service override in the repository, mapped to contracts. |
| Edit | `public void Edit(long billId, long sequenceId, Contract.AuditedServiceOverride auditedServiceOverrideEdit)` | Loads the override matching `billId`/`sequenceId`, stamps `auditedServiceOverrideEdit` with the current transaction info, copies its fields onto the stored entity, and commits; rolls back and rethrows on any exception. |
| Add | `public void Add(Contract.AuditedServiceOverride auditedServiceOverrideEdit)` | Stamps `auditedServiceOverrideEdit`, creates a new override entity from its fields, adds it to the repository, and commits; rolls back and rethrows on any exception. |
| Delete | `public void Delete(long id, long billId)` | Loads the override matching `id`/`billId` and deletes it, committing the transaction; rolls back and rethrows on any exception. |

## Behavioral notes
- Every write operation (`Edit`, `Add`, `Delete`) is wrapped in `unitOfWork.Begin()`/`Commit()`, with an explicit `Rollback()` and rethrow in the `catch` block, ensuring failed writes never partially commit.
- `Delete`'s parameter order is `(id, billId)`, the reverse of `Get`'s `(id, auditSequenceId)`, despite both ultimately calling the same private `GetOverrideById(billId, auditSequenceNumber)` lookup — callers must pass arguments in the correct order for each method*.
- The injected `IValidationService` is stored but not called from any of the members shown, so no FluentValidation rules currently run before writes in this type*.

> **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
- Services/SAIF.Services/Edi/AuditedServiceOverrideService.cs
