Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

EntityConnection Constructor

Entity Framework 6.0
 

Constructs the EntityConnection object with a connection not yet associated to a particular store.

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

NameDescription
System_CAPS_pubmethodEntityConnection()

Initializes a new instance of the EntityConnection class.

System_CAPS_pubmethodEntityConnection(MetadataWorkspace^, DbConnection^)

Initializes a new instance of the EntityConnection class with a specified MetadataWorkspace and DbConnection.

System_CAPS_pubmethodEntityConnection(MetadataWorkspace^, DbConnection^, Boolean)

Constructs the EntityConnection from Metadata loaded in memory

System_CAPS_pubmethodEntityConnection(String^)

Initializes a new instance of the EntityConnection class, based on the connection string.

Return to top

EntityConnection Constructor ()

Initializes a new instance of the EntityConnection class.

public:
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", 
	Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
EntityConnection()
Return to top

EntityConnection Constructor (MetadataWorkspace^, DbConnection^)

Initializes a new instance of the EntityConnection class with a specified MetadataWorkspace and DbConnection.

public:
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", 
	Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
EntityConnection(
	MetadataWorkspace^ workspace,
	DbConnection^ connection
)

Parameters

workspace
Type: System.Data.Entity.Core.Metadata.Edm::MetadataWorkspace^

A MetadataWorkspace to be associated with this EntityConnection.

connection
Type: System.Data.Common::DbConnection^

The underlying data source connection for this EntityConnection object.

Exception Condition
ArgumentNullException

The workspace or connection parameter is null.

ArgumentException

The conceptual model is missing from the workspace.-or-The mapping file is missing from the workspace.-or-The storage model is missing from the workspace.-or-The connection is not in a closed state.

ProviderIncompatibleException

The connection is not from an ADO.NET Entity Framework-compatible provider.

Return to top

EntityConnection Constructor (MetadataWorkspace^, DbConnection^, Boolean)

Constructs the EntityConnection from Metadata loaded in memory

public:
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", 
	Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
EntityConnection(
	MetadataWorkspace^ workspace,
	DbConnection^ connection,
	bool entityConnectionOwnsStoreConnection
)

Parameters

workspace
Type: System.Data.Entity.Core.Metadata.Edm::MetadataWorkspace^

Workspace containing metadata information.

connection
Type: System.Data.Common::DbConnection^

Store connection.

entityConnectionOwnsStoreConnection
Type: System::Boolean

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

Return to top

EntityConnection Constructor (String^)

Initializes a new instance of the EntityConnection class, based on the connection string.

public:
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", 
	Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
[SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
EntityConnection(
	String^ connectionString
)

Parameters

connectionString
Type: System::String^

The provider-specific connection string.

Exception Condition
ArgumentException

An invalid connection string keyword has been provided, or a required connection string keyword has not been provided.

Return to top
Show: