Share via


EntityConnection Constructors

Definition

Overloads

EntityConnection()

Initializes a new instance of the EntityConnection class.

EntityConnection(String)

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

EntityConnection(MetadataWorkspace, DbConnection)

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

EntityConnection(MetadataWorkspace, DbConnection, Boolean)

Constructs the EntityConnection from Metadata loaded in memory

EntityConnection()

Initializes a new instance of the EntityConnection class.

[System.Diagnostics.CodeAnalysis.SuppressMessage("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 ();
Public Sub New ()
Attributes

Applies to

EntityConnection(String)

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

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("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 (string connectionString);
new System.Data.Entity.Core.EntityClient.EntityConnection : string -> System.Data.Entity.Core.EntityClient.EntityConnection
Public Sub New (connectionString As String)

Parameters

connectionString
String

The provider-specific connection string.

Attributes

Exceptions

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

Applies to

EntityConnection(MetadataWorkspace, DbConnection)

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

[System.Diagnostics.CodeAnalysis.SuppressMessage("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 (System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace workspace, System.Data.Common.DbConnection connection);
new System.Data.Entity.Core.EntityClient.EntityConnection : System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace * System.Data.Common.DbConnection -> System.Data.Entity.Core.EntityClient.EntityConnection
Public Sub New (workspace As MetadataWorkspace, connection As DbConnection)

Parameters

workspace
MetadataWorkspace

A MetadataWorkspace to be associated with this EntityConnection.

connection
DbConnection

The underlying data source connection for this EntityConnection object.

Attributes

Exceptions

The workspace or connection parameter is null.

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.

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

Applies to

EntityConnection(MetadataWorkspace, DbConnection, Boolean)

Constructs the EntityConnection from Metadata loaded in memory

[System.Diagnostics.CodeAnalysis.SuppressMessage("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 (System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace workspace, System.Data.Common.DbConnection connection, bool entityConnectionOwnsStoreConnection);
new System.Data.Entity.Core.EntityClient.EntityConnection : System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace * System.Data.Common.DbConnection * bool -> System.Data.Entity.Core.EntityClient.EntityConnection
Public Sub New (workspace As MetadataWorkspace, connection As DbConnection, entityConnectionOwnsStoreConnection As Boolean)

Parameters

workspace
MetadataWorkspace

Workspace containing metadata information.

connection
DbConnection

Store connection.

entityConnectionOwnsStoreConnection
Boolean

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

Attributes

Applies to