# Unit of Work Pattern

Record: `arch:unit-of-work-pattern`
Kind: pattern
Layer: [Atomic Boundary](https://banes-lab.com/records/layer/atomic-boundary.md)
Severity: recommended
Scope: application service, persistence
Aliases: Unit of Work
Canonical: https://banes-lab.com/ontology#arch-unit-of-work-pattern

## Repair

- Refactored by: Introduce Unit of Work
- Detected by: multiple independent saves in one use case
- Violated by: unmanaged partial persistence
- Measured by: save coordination defects
- Enforced by: persistence conventions

## requires

- [Transaction Boundary](https://banes-lab.com/records/arch/transaction-boundary.md)

## reinforces

- [Atomicity](https://banes-lab.com/records/arch/atomicity.md)
- [Consistency](https://banes-lab.com/records/arch/consistency.md)

## enables

- [Coordinated Persistence](https://banes-lab.com/records/lex/coordinated-persistence.md)

## conflicts-with

- [Scattered Save Calls](https://banes-lab.com/records/lex/scattered-save-calls.md)

## tensions-with

- [Repository Complexity](https://banes-lab.com/records/lex/repository-complexity.md)

## tensions

- [Unit of Work Pattern Repository Complexity](https://banes-lab.com/records/tension/repository-complexity-unit-of-work-pattern.md)

## referenced-by

- [Transaction Boundary](https://banes-lab.com/records/arch/transaction-boundary.md)
