Share via


DbContext Constructor (ObjectContext, 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.]

Constructs a new context instance around an existing ObjectContext.

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

Syntax

'Declaration
Public Sub New ( _
    objectContext As ObjectContext, _
    dbContextOwnsObjectContext As Boolean _
)
'Usage
Dim objectContext As ObjectContext 
Dim dbContextOwnsObjectContext As Boolean 

Dim instance As New DbContext(objectContext, _
    dbContextOwnsObjectContext)
public DbContext(
    ObjectContext objectContext,
    bool dbContextOwnsObjectContext
)
public:
DbContext(
    ObjectContext^ objectContext, 
    bool dbContextOwnsObjectContext
)
new : 
        objectContext:ObjectContext * 
        dbContextOwnsObjectContext:bool -> DbContext
public function DbContext(
    objectContext : ObjectContext, 
    dbContextOwnsObjectContext : boolean
)

Parameters

  • dbContextOwnsObjectContext
    Type: System.Boolean
    If set to true the ObjectContext is disposed when the DbContext is disposed, otherwise the caller must dispose the connection.

See Also

Reference

DbContext Class

DbContext Overload

System.Data.Entity Namespace