Design Patterns (GoF) (50 Qs)•Part 2: Behavioral Patterns & Communication (11 - 24)
What is the Unit of Work Pattern?
junior LevelBehavioral
In Simple Words: Maintains a list of business objects affected by a business transaction and coordinates the writing out of changes:
- Instead of saving every entity modification to the database immediately (incurring 10 separate SQL round-trips):
- The Unit of Work tracks all dirty, new, and deleted objects in memory, and commits them inside a single atomic database transaction upon completion.