Last post Mar 28, 2017 03:20 PM by deepalgorithm
Mar 28, 2017 02:40 PM|mamoni.kol2017|LINK
please some one tell me what is Unit of work in EF with example. i saw Unit of work words always come with EF repository pattern. what it does ?
without Unit of work repository pattern can not be implemented ?
Mar 28, 2017 03:20 PM|deepalgorithm|LINK
Unit of Work keeps track of everything you do during a business transaction that can affect the database." Within the context of Entity Framework, creating a unit of work involves sharing a single database context.
Basics here: https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application
You can implement the repository pattern without unit of work. They are separate patterns, but often used together.
That being said - technically in EF the DBContext is the unit of work and the IDbSet is a repository. By implementing your own, you are adding an abstraction on top of an abstraction.