EntityConnection 构造函数 (MetadataWorkspace, DbConnection, Boolean)
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
从内存中加载的元数据构造 EntityConnection
命名空间: System.Data.Entity.Core.EntityClient
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification := "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")> _
Public Sub New ( _
workspace As MetadataWorkspace, _
connection As DbConnection, _
entityConnectionOwnsStoreConnection As Boolean _
)
用法
Dim workspace As MetadataWorkspace
Dim connection As DbConnection
Dim entityConnectionOwnsStoreConnection As Boolean
Dim instance As New EntityConnection(workspace, _
connection, entityConnectionOwnsStoreConnection)
[SuppressMessageAttribute("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(
MetadataWorkspace workspace,
DbConnection connection,
bool entityConnectionOwnsStoreConnection
)
[SuppressMessageAttribute(L"Microsoft.Reliability", L"CA2000:DisposeObjectsBeforeLosingScope", Justification = L"Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
public:
EntityConnection(
MetadataWorkspace^ workspace,
DbConnection^ connection,
bool entityConnectionOwnsStoreConnection
)
[<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")>]
new :
workspace:MetadataWorkspace *
connection:DbConnection *
entityConnectionOwnsStoreConnection:bool -> EntityConnection
public function EntityConnection(
workspace : MetadataWorkspace,
connection : DbConnection,
entityConnectionOwnsStoreConnection : boolean
)
参数
- workspace
类型:System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace
包含元数据信息的工作区。
- connection
类型:System.Data.Common.DbConnection
存储连接。
- entityConnectionOwnsStoreConnection
类型:System.Boolean
如果设置为 true,则释放实体连接时将释放该存储连接;否则调用方必须释放该存储连接。