unit of work

A pattern that collects the changes made during one business operation and commits them together, or not at all.

In more detail

A money transfer that debits one account and credits another must commit both or neither. In a web application one request usually forms one unit of work. In React's rendering engine the phrase has a different meaning: one small piece of rendering work for a single fiber, after which React can pause to let the browser respond.

Example

EF Core: a DbContext collects tracked changes and SaveChanges writes them in one transaction.

Related terms

Taught in

References