Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DbContext Constructor (DbConnection, 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 using the existing connection to connect to a database. The connection will not be disposed when the context is disposed if contextOwnsConnection is false.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)
[SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public DbContext(
	DbConnection existingConnection,
	bool contextOwnsConnection
)

Parameters

existingConnection
Type: System.Data.Common.DbConnection
An existing connection to use for the new 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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.