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)

'Declaration
Public Sub New ( _
	existingConnection As DbConnection, _
	model As DbCompiledModel, _
	contextOwnsConnection As Boolean _
)
'Usage
Dim existingConnection As DbConnection 
Dim model As DbCompiledModel 
Dim contextOwnsConnection As Boolean 

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

Parameters

existingConnection
Type: System.Data.Common.DbConnection

An existing connection to use for the new context.

model
Type: System.Data.Entity.Infrastructure.DbCompiledModel

The model that will back this context.

contextOwnsConnection
Type: System.Boolean

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

Show:
© 2015 Microsoft