EntityConnection Constructor

 

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.


EntityConnection Constructor ()

Initializes a new instance of the EntityConnection class.

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

EntityConnection Constructor (MetadataWorkspace, DbConnection)

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

[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", 
	Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
public 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.


EntityConnection Constructor (MetadataWorkspace, DbConnection, Boolean)

Constructs the EntityConnection from Metadata loaded in memory

[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", 
	Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
public 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.


EntityConnection Constructor (String)

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

[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")]
public 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.