EntityConnection 构造函数

定义

重载

EntityConnection()

初始化 EntityConnection 类的新实例。

EntityConnection(String)

基于连接字符串初始化 EntityConnection 类的新实例。

EntityConnection(MetadataWorkspace, DbConnection)

使用指定的 EntityConnectionMetadataWorkspace 初始化 DbConnection 类的新实例。

EntityConnection(MetadataWorkspace, DbConnection, Boolean)

从内存中加载的元数据构造 EntityConnection

EntityConnection()

初始化 EntityConnection 类的新实例。

[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 ()
属性

适用于

EntityConnection(String)

基于连接字符串初始化 EntityConnection 类的新实例。

[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)

参数

connectionString
String

提供程序特定的连接字符串。

属性

例外

提供的连接字符串关键字无效,或未提供所需的连接字符串关键字。

适用于

EntityConnection(MetadataWorkspace, 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)

参数

workspace
MetadataWorkspace

与此 MetadataWorkspace 关联的 EntityConnection

connection
DbConnection

EntityConnection 对象的基础数据源连接。

属性

例外

workspace 或 connection 参数为 null。

工作区中缺少概念模型。-或工作区中缺少映射文件。-或工作区中缺少存储模型。-或-连接未处于关闭状态。

connection 并非来自与 ADO.NET Entity Framework 兼容的提供程序。

适用于

EntityConnection(MetadataWorkspace, DbConnection, Boolean)

从内存中加载的元数据构造 EntityConnection

[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)

参数

workspace
MetadataWorkspace

包含元数据信息的工作区。

connection
DbConnection

存储连接。

entityConnectionOwnsStoreConnection
Boolean

如果设置为 true,则在释放实体连接时释放存储连接,否则调用方必须释放存储连接。

属性

适用于