DbContext.Dispose Method (Boolean)

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Disposes the context. The underlying ObjectContext is also disposed if it was created is by this context or ownership was passed to this context when this context was created. The connection to the database ( DbConnection object) is also disposed if it was created is by this context or ownership was passed to this context when this context was created.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

Syntax

'Declaration
Protected Overridable Sub Dispose ( _
    disposing As Boolean _
)
'Usage
Dim disposing As Boolean 

Me.Dispose(disposing)
protected virtual void Dispose(
    bool disposing
)
protected:
virtual void Dispose(
    bool disposing
)
abstract Dispose : 
        disposing:bool -> unit  
override Dispose : 
        disposing:bool -> unit
protected function Dispose(
    disposing : boolean
)

Parameters

  • disposing
    Type: System.Boolean
    true to release both managed and unmanaged resources; false to release only unmanaged resources.

See Also

Reference

DbContext Class

Dispose Overload

System.Data.Entity Namespace