A unit of work[1] is a behavioral pattern in software development. Martin Fowler has defined it as everything one does during a business transaction which can affect the database.[2] When the unit of work is finished, it will provide everything that needs to be done to change the database as a result of the work.[2]
A unit of work encapsulates one or more code repositories[de] and a list of actions to be performed which are necessary for the successful implementation of self-contained and consistent data change. A unit of work is also responsible for handling concurrency issues,[3][4] and can be used for transactions[3][4] and stability patterns.[de][5]