Entity framework memory not released

c# entity-framework entity-framework-6

Popular Answer

You would then need to implement IDisposable in the internally controlled class that descended from DbContext in your situation, then inside the LocalContext, add the following:

public void Dispose()
{
    this.Dispose(true);
    GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
     if (disposing)
     {
        // Manage any native resources.
     }
   //Handle any other cleanup.
}

The using statement will just call Dispose() against the base class, whereas you need to dispose of the parent and base, unless you specifically override it.

4
2/9/2014 8:51:20 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow