EntityConnection 建構函式 (MetadataWorkspace, DbConnection, Boolean)
[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 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,則處置實體連接時也會處置此存放區連接,否則呼叫端必須處置此存放區連接。