By dotCore
via dotnet.dzone.com
Published: Oct 20 2012 / 05:33
The Entity Framework DbContext (or LINQ-to-SQL DataContext) are Unit Of Work implementations. That means that the same DbContext should be used for all operations (both reading and writing) within a single web or service request. That means that there are a lot of different places where the DbContext have to be accessed. To avoid having to pass the DbContext around as a parameter, I’ve created a UnitOfWorkScope that makes the DbContext ambient and easily accessible.
Add your comment