Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DbContext Constructor (DbConnection, DbCompiledModel, Boolean)

DbContext Constructor (DbConnection, DbCompiledModel, Boolean)

Entity Framework 5.0

Constructs a new context instance using the existing connection to connect to a database, and initializes it from the given model. The connection will not be disposed when the context is disposed.

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

Public Sub New ( _
	existingConnection As DbConnection, _
	model As DbCompiledModel, _
	contextOwnsConnection As Boolean _
Dim existingConnection As DbConnection 
Dim model As DbCompiledModel 
Dim contextOwnsConnection As Boolean 

Dim instance As New DbContext(existingConnection, _
	model, contextOwnsConnection)


Type: System.Data.Common.DbConnection

An existing connection to use for the new context.

Type: System.Data.Entity.Infrastructure.DbCompiledModel

The model that will back this context.

Type: System.Boolean

If set to true the connection is disposed when the context is disposed, otherwise the caller must dispose the connection.

© 2015 Microsoft