Share via


EntityConnection Class

Definition

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
Inheritance
EntityConnection

Constructors

EntityConnection()

Initializes a new instance of the EntityConnection class.

EntityConnection(MetadataWorkspace, DbConnection, Boolean)

Constructs the EntityConnection from Metadata loaded in memory

EntityConnection(MetadataWorkspace, DbConnection)

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

EntityConnection(String)

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

Properties

ConnectionString

Gets or sets the EntityConnection connection string.

ConnectionTimeout

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

CurrentTransaction

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

Database

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

DataSource

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

DbProviderFactory

Gets the provider factory associated with EntityConnection

ServerVersion

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

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

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

Methods

BeginDbTransaction(IsolationLevel)

Begins a database transaction

BeginTransaction()

Begins a transaction by using the underlying provider.

BeginTransaction(IsolationLevel)

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

ChangeDatabase(String)

Not supported.

Close()

Closes the connection to the database.

CreateCommand()

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

CreateDbCommand()

Create a new command object that uses this connection object

Dispose(Boolean)

Cleans up this connection object

EnlistTransaction(Transaction)

Enlists this EntityConnection in the specified transaction.

GetMetadataWorkspace()

Returns the MetadataWorkspace associated with this EntityConnection .

Open()

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

OpenAsync(CancellationToken)

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

Applies to