Unit of Work is a design pattern which maintains a list of transactions ,updates the data source with the changes and also provides solution to the concurrency problems. When implementing a Repository pattern it is also important to understand the Unit of Work pattern. While repositories are used to create an abstraction layer between the data layer and the business layer of an application, the unit of work pattern coordinates the work of multiple repositories by enforcing a single database context class shared by all of them.

A Unit of Work can consist of different types of operations such as Web Service calls, Database operations, or even in-memory operations, however, the focus of this article will be on approaches to facilitating the Unit of Work pattern with Entity Framework. Unit of work is one of them - a concept for dealing with certain issues related to database interactions.

A Unit of Work keeps track of everything you do during a business transaction that can affect the database. However, the repository isn't always in a MS SQL database.

The Unit of Work Pattern is a pattern that handles the transactions during data manipulation using the Repository Pattern. Unit of Work. So if the appliation is performing multiple concurrent operations then Unit of Work is the solution. The ITransaction interface in NHibernate, the DataContext class in LINQ to SQL, and the ObjectContext class in the Entity Framework are all examples of a Unit of Work. Unit Of Work. Unit Of Work Pattern. \$\begingroup\$ If you have an application where everything is hosted in a single MS SQL database, this answer is correct. The Unit of Work pattern isn't necessarily something that you will explicitly build yourself, but the pattern shows up in almost every persistence tool that I'm aware of. Fowler provides an explanation of the Unit Of Work pattern. Don't do that. In software development, a design pattern is a reusable solution, description or a template for solving problems. Similarly, in computing terms, a repository is a central location in which data for a specific type of entity or entities are stored and managed either in a form of collection or table. Repository Pattern. Hence the onset of Microservices, where one context per entity is desired, allowing an entity to exist anywhere: cloud service, database, SAP, Salesforce, NoSQL, Xml, Excel, wherever.

Repository, as it implies, is a place where things are stored and can be found and retrieved whenever needed.