user384080
user384080

Reputation: 4692

When to dispose dbcontext while using ef second level cache

People on the inet advise to use "using" clause with the dbcontext.. That means the dbcontext object is getting disposed.. If that's the case, then how this dbcontext will get benefit of having second level caching (http://msdn.microsoft.com/en-us/magazine/hh394143.aspx) ?

Upvotes: 0

Views: 494

Answers (1)

Anders Abel
Anders Abel

Reputation: 69260

The article you link to hooks inte EF's provider model an implements cache at a lower layer than the DbContext. You should still use the DbContext as a unit of work and dispose of it as soon as you're done with one set of operations.

Upvotes: 1

Related Questions