EntityConnection EntityConnection EntityConnection Class


Class representing a connection for the conceptual layer. An entity connection may only be initialized once (by opening the connection). It is subsequently not possible to change the connection string, attach a new store connection, or change the store connection string.

public class EntityConnection : System.Data.Common.DbConnection
type EntityConnection = class
    inherit DbConnection
Public Class EntityConnection
Inherits DbConnection


EntityConnection() EntityConnection() EntityConnection()

Initializes a new instance of the EntityConnection class.

EntityConnection(String) EntityConnection(String) EntityConnection(String)

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

EntityConnection(MetadataWorkspace, DbConnection) EntityConnection(MetadataWorkspace, DbConnection) EntityConnection(MetadataWorkspace, DbConnection)

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

EntityConnection(MetadataWorkspace, DbConnection, Boolean) EntityConnection(MetadataWorkspace, DbConnection, Boolean) EntityConnection(MetadataWorkspace, DbConnection, Boolean)

Constructs the EntityConnection from Metadata loaded in memory


ConnectionString ConnectionString ConnectionString

Gets or sets the EntityConnection connection string.

ConnectionTimeout ConnectionTimeout ConnectionTimeout

Gets the number of seconds to wait when attempting to establish a connection before ending the attempt and generating an error.

CurrentTransaction CurrentTransaction CurrentTransaction

Gets the current transaction that this connection is enlisted in. May be null.

Database Database Database

Gets the name of the current database, or the database that will be used after a connection is opened.

DataSource DataSource DataSource

Gets the name or network address of the data source to connect to.

DbProviderFactory DbProviderFactory DbProviderFactory

Gets the provider factory associated with EntityConnection

ServerVersion ServerVersion ServerVersion

Gets a string that contains the version of the data source to which the client is connected.

State State State

Gets the state of the EntityConnection, which is set up to track the state of the underlying database connection that is wrapped by this EntityConnection.

StoreConnection StoreConnection StoreConnection

Provides access to the underlying data source connection that is used by the EntityConnection object.


BeginDbTransaction(IsolationLevel) BeginDbTransaction(IsolationLevel) BeginDbTransaction(IsolationLevel)

Begins a database transaction

BeginTransaction() BeginTransaction() BeginTransaction()

Begins a transaction by using the underlying provider.

BeginTransaction(IsolationLevel) BeginTransaction(IsolationLevel) BeginTransaction(IsolationLevel)

Begins a transaction with the specified isolation level by using the underlying provider.

ChangeDatabase(String) ChangeDatabase(String) ChangeDatabase(String)

Not supported.

Close() Close() Close()

Closes the connection to the database.

CreateCommand() CreateCommand() CreateCommand()

Creates a new instance of an EntityCommand, with the Connection set to this EntityConnection .

CreateDbCommand() CreateDbCommand() CreateDbCommand()

Create a new command object that uses this connection object

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Cleans up this connection object

EnlistTransaction(Transaction) EnlistTransaction(Transaction) EnlistTransaction(Transaction)

Enlists this EntityConnection in the specified transaction.

GetMetadataWorkspace() GetMetadataWorkspace() GetMetadataWorkspace()

Returns the MetadataWorkspace associated with this EntityConnection .

Open() Open() Open()

Establishes a connection to the data source by calling the underlying data provider's Open method.

OpenAsync(CancellationToken) OpenAsync(CancellationToken) OpenAsync(CancellationToken)

Asynchronously establishes a connection to the data store by calling the Open method on the underlying data provider

Applies to