.NET Framework Class Library EntityConnection Class Contains a reference to a conceptual model and a data source connection. This class cannot be inherited.

Inheritance Hierarchy
Namespace:
System.Data.EntityClient
Assembly:
System.Data.Entity (in System.Data.Entity.dll)

Syntax
Public NotInheritable Class EntityConnection _
Inherits DbConnection
public sealed class EntityConnection : DbConnection
public ref class EntityConnection sealed : public DbConnection
[<Sealed>]
type EntityConnection =
class
inherit DbConnection
end
The EntityConnection type exposes the following members.

Constructors

Properties

Methods

Events

Explicit Interface Implementations

Remarks
To avoid inadvertently putting objects such as System.Data.Common.CommandTrees and ObjectContext out of sync with their metadata, EntityConnection 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 instance is constructed through the default constructor, or through 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. The EntityConnection instance is constructed through 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.
When metadata is loaded, the EntityConnection verifies that the conceptual model, the storage model, and the mapping file are all present. For code examples, see Working with EntityClient.

Version Information
.NET FrameworkSupported in: 4, 3.5 SP1 .NET Framework Client ProfileSupported in: 4

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also
|
Biblioteca de clases de .NET Framework EntityConnection (Clase) Contiene una referencia a un modelo conceptual y una conexión a un origen de datos. Esta clase no puede heredarse.

Jerarquía de herencia
Espacio de nombres:
System.Data.EntityClient
Ensamblado:
System.Data.Entity (en System.Data.Entity.dll)

Sintaxis
Public NotInheritable Class EntityConnection _
Inherits DbConnection
public sealed class EntityConnection : DbConnection
public ref class EntityConnection sealed : public DbConnection
[<Sealed>]
type EntityConnection =
class
inherit DbConnection
end
El tipo EntityConnection expone los siguientes miembros.

Constructores

Propiedades

Métodos

Eventos

Implementaciones explícitas de interfaces

Comentarios
Para evitar que objetos como System.Data.Common.CommandTrees y ObjectContext dejen de estar sincronizados involuntariamente con sus metadatos, EntityConnection debe bloquear los metadatos. No se permiten cambios en la cadena de conexión una vez bloqueados los metadatos. A continuación se presentan dos escenarios en los que se bloquean los metadatos: La instancia de EntityConnection se crea mediante el constructor predeterminado, o mediante el constructor EntityConnection(String), que acepta una cadena de conexión. En cualquiera de los casos, la cadena de conexión se puede cambiar varias veces antes de abrirse la conexión. La llamada a los métodos [M:System.Data.EntityClient.EntityConnection.Open()] o [M:System.Data.EntityClient.EntityConnection.GetMetadataWorkspace()] bloquea los metadatos. La instancia de EntityConnection se crea mediante el constructor EntityConnection(MetadataWorkspace, DbConnection), que acepta MetadataWorkspace y DbConnection. En este caso, los metadatos se bloquean en el momento de la creación. No se permiten en ningún caso cambios en la cadena de conexión.
Cuando se cargan los metadatos, EntityConnection comprueba que el modelo conceptual, el modelo de almacenamiento y el archivo de asignación estén presentes. Para obtener ejemplos de código, vea Working with EntityClient.

Información de versión
.NET FrameworkCompatible con: 4, 3.5 SP1 .NET Framework Client ProfileCompatible con: 4

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Seguridad para subprocesos
Todos los miembros static ( Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Vea también
|