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 DbContext(
	DbConnection existingConnection,
	DbCompiledModel model,
	bool 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: