Contains a reference to a conceptual model and a data source connection. This class cannot be inherited.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
Initializes a new instance of theclass.
Initializes a new instance of theclass, based on the connection string.
Gets or sets the DbConnection.ConnectionString.)connection string.(Overrides
Gets the number of seconds to wait when attempting to establish a connection before ending the attempt and generating an error.(Overrides DbConnection.ConnectionTimeout.)
Gets the name of the current database, or the database that will be used after a connection is opened.(Overrides DbConnection.Database.)
Gets the name or network address of the data source to connect to.(Overrides DbConnection.DataSource.)
Gets a string that contains the version of the data source to which the client is connected.(Overrides DbConnection.ServerVersion.)
Provides access to the underlying data source connection that is used by theobject.
Begins a transaction by using the underlying provider.
Begins a transaction with the specified isolation level by using the underlying provider.
Not supported.(Overrides DbConnection.ChangeDatabase(String).)
Closes the connection to the database.(Overrides DbConnection.Close().)
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)
Enlists this DbConnection.EnlistTransaction(Transaction).)in the specified transaction.(Overrides
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
Returns the MetadataWorkspace associated with this .
Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
Establishes a connection to the data source by calling the underlying data provider's Open method.(Overrides DbConnection.Open().)
This is the asynchronous version of Open. Providers should override with an appropriate implementation. The cancellation token can optionally be honored.
The default implementation invokes the synchronous Open call and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by Open will be communicated via the returned Task Exception property.
Do not invoke other methods and properties of the DbConnection object until the returned Task is complete.(Inherited from DbConnection.)
Begins a database transaction.(Inherited from DbConnection.)
To avoid inadvertently putting objects such as System.Data.Common.CommandTrees and ObjectContext out of sync with their metadata, must lock its metadata. No changes to the connection string are allowed after the metadata is locked. The following are two scenarios in which metadata is locked:
The EntityConnection(String) constructor, which accepts a connection string. In either case the connection string might be changed multiple times before the connection is opened. Calling M:System.Data.EntityClient.EntityConnection.Open() or M:System.Data.EntityClient.EntityConnection.GetMetadataWorkspace() locks the metadata.instance is constructed through the default constructor, or through the
The EntityConnection(MetadataWorkspace, DbConnection) constructor, which accepts a MetadataWorkspace and a DbConnection. In this case, the metadata is locked at construction time. No changes to the connection string are ever allowed.instance is constructed through the
When metadata is loaded, theverifies that the conceptual model, the storage model, and the mapping file are all present.
For code examples, see .dec4728c-8dff-4e30-abe0-0f78fb5d5af5
Available since 3.5
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.