Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of "Unit of Work" concept in NHibernate and other ORMs?

What is the meaning of "Unit of Work" concept in NHibernate and other ORMs?

like image 984
masoud ramezani Avatar asked May 23 '10 08:05

masoud ramezani


People also ask

What is unit of work in entity Framework?

The unit of work class coordinates the work of multiple repositories by creating a single database context class shared by all of them.

What is unit of work in database?

A unit of work is a recoverable sequence of operations within an application process. It is used by the database manager to ensure that a database is in a consistent state. Any reading from or writing to the database is done within a unit of work.

What is unit of work in .NET core?

The Unit of Work pattern is used to aggregate multiple operations into a single transaction. With this we ensure that either all operations succeed or fail as a single unit. Note that you can use the Repository pattern without using the Unit of Work pattern.

What is unit of work design pattern?

The Unit of Work pattern is used to group one or more operations (usually database CRUD operations) into a single transaction or “unit of work” so that all operations either pass or fail as one unit.


1 Answers

It is explained very well in this blog post.

"A Unit of Work keeps track of everything you do during a business transaction that can affect the database. When you're done, it figures out everything that needs to be done to alter the database as a result of your work."

like image 161
Darin Dimitrov Avatar answered Nov 03 '22 00:11

Darin Dimitrov