---
title: OracleUnitOfWorkFactory
summary: API reference for OracleUnitOfWorkFactory.
status: draft
owner: Framework
last_reviewed: 2026-09-15
library: SAIF.Framework.Data.NHibernate
reference_type: package
---

# OracleUnitOfWorkFactory

`OracleUnitOfWorkFactory` is the stateful Oracle implementation of `UnitOfWorkFactoryBase`. It opens a stateful NHibernate `ISession` against Oracle and wraps it in `StatefulSessionStrategy`, pairing it with `OracleConfigurationFactory` for configuration and `OracleSessionHelper` for engine-specific session helper behavior.

## Purpose
- Overrides `CreateUnitOfWork` to open a stateful Oracle `ISession` (`factory.OpenSession()`) and wrap it in `StatefulSessionStrategy`, giving consumers full change-tracking, lazy-loading, and first-level cache behavior (contrast with [BR-003](../../business-rules.md#br-003-stateless-updates-require-explicit-persistence), which governs the stateless factories).
- Overrides `BuildSessionHelper` to return an `OracleSessionHelper`, used for Oracle-specific ID/sequence handling in repository operations.

## Context
- Namespace: `SAIF.Data.NHibernate`
- Assembly/package: `SAIF.Framework.Data.NHibernate`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| OracleUnitOfWorkFactory() | `public OracleUnitOfWorkFactory()` | Default constructor; wires an internal `OracleConfigurationFactory` for configuration resolution. |

## Inherited public members

Members in this section are inherited from `UnitOfWorkFactoryBase` in `SAIF.Framework.Data.NHibernate`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| GetUnitOfWork | `NHibernateUnitOfWork GetUnitOfWork(string connectionString, int batchSize, bool showSql)` | Resolves a cached or new `ISessionFactory`, opens a stateful Oracle session via `CreateUnitOfWork`, and returns a `NHibernateUnitOfWork`. | `SAIF.Framework.Data.NHibernate` — `UnitOfWorkFactoryBase` |

## Behavioral notes
- Every unit of work produced by this factory uses full NHibernate change tracking; entities loaded through it are tracked for flush-time change detection (contrast with `OracleStatelessUnitOfWorkFactory`).

## Constraints and usage notes
- Requires an Oracle-compatible connection string; pairs with `OracleConfigurationFactory` internally and cannot be redirected to a different engine's configuration factory.

## Sources
- `Factories/OracleUnitOfWorkFactory.cs`
- `Factories/UnitOfWorkFactoryBase.cs`
