ObjectContext 建構函式 (EntityConnection, Boolean)
[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]
建立具有指定連接和中繼資料工作空間的 ObjectContext。
命名空間: System.Data.Entity.Core.Objects
組件: EntityFramework (在 EntityFramework.dll 中)
語法
'宣告
Public Sub New ( _
connection As EntityConnection, _
contextOwnsConnection As Boolean _
)
'用途
Dim connection As EntityConnection
Dim contextOwnsConnection As Boolean
Dim instance As New ObjectContext(connection, _
contextOwnsConnection)
public ObjectContext(
EntityConnection connection,
bool contextOwnsConnection
)
public:
ObjectContext(
EntityConnection^ connection,
bool contextOwnsConnection
)
new :
connection:EntityConnection *
contextOwnsConnection:bool -> ObjectContext
public function ObjectContext(
connection : EntityConnection,
contextOwnsConnection : boolean
)
參數
- connection
類型:System.Data.Entity.Core.EntityClient.EntityConnection
存放區的連接
- contextOwnsConnection
類型:System.Boolean
如果設定為 true,則處置內容時也會處置此連接,否則呼叫端必須處置此連接。