DbCommandInterceptionContext 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表與呼叫實 IDbCommandInterceptor 作相關的情境資訊。
public class DbCommandInterceptionContext : System.Data.Entity.Infrastructure.Interception.DbInterceptionContext
type DbCommandInterceptionContext = class
inherit DbInterceptionContext
Public Class DbCommandInterceptionContext
Inherits DbInterceptionContext
- 繼承
- 衍生
備註
此類別的實例會傳遞給 的 DbCommandDispatcher 派遣方法,且不包含可變資訊,例如操作結果。 這些可變資訊是從 DbCommandInterceptionContext<TResult> 傳遞給攔截器的 中獲得的。 此類別的實例是公開不變的。 要補充上下文資訊,請使用其中一種 With...或是 As...建立包含新資訊的新攔截上下文的方法。
建構函式
| 名稱 | Description |
|---|---|
| DbCommandInterceptionContext() |
建構一個沒有狀態的新事物 DbCommandInterceptionContext 。 |
| DbCommandInterceptionContext(DbInterceptionContext) |
透過從給定攔截上下文複製狀態來建立新的 DbCommandInterceptionContext 狀態。 另見 Clone() |
屬性
| 名稱 | Description |
|---|---|
| CommandBehavior |
該 CommandBehavior 將被使用或已使用來執行帶有 DbDataReader的指令。 此性質僅用於 及其 ExecuteReader(CommandBehavior) 非同步對應物。 |
| DbContexts |
取得 DbContext 所有與此攔截上下文相關的實例。 (繼承來源 DbInterceptionContext) |
| IsAsync |
若操作是非同步執行,則為真;否則為假。 (繼承來源 DbInterceptionContext) |
| ObjectContexts |
取得 ObjectContext 所有與此攔截上下文相關的實例。 (繼承來源 DbInterceptionContext) |
方法
| 名稱 | Description |
|---|---|
| AsAsync() |
建立一個包含此攔截上下文IsAsync中所有上下文資訊的新文件DbCommandInterceptionContext,該標記設為 true。 |
| Clone() |
在建立攔截上下文副本以新增狀態時,呼叫此方法。 使用此方法代替直接呼叫建構子,可確保虛擬派遣,使新型態擁有與被克隆上下文相同的型態(及任何專用狀態)。 |
| Equals(Object) |
代表與呼叫實 IDbCommandInterceptor 作相關的情境資訊。 |
| GetHashCode() |
代表與呼叫實 IDbCommandInterceptor 作相關的情境資訊。 |
| GetType() |
取得目前實例的 Type。 |
| ToString() |
代表與呼叫實 IDbCommandInterceptor 作相關的情境資訊。 |
| WithCommandBehavior(CommandBehavior) |
建立 DbCommandInterceptionContext 一個新 ,包含該攔截上下文中所有上下文資訊,連同給定 CommandBehavior的 。 |
| WithDbContext(DbContext) |
建立 DbCommandInterceptionContext 一個新 ,包含此攔截上下文中所有上下文資訊,並加上給定 ObjectContext的 。 |
| WithObjectContext(ObjectContext) |
建立 DbCommandInterceptionContext 一個新 ,包含此攔截上下文中所有上下文資訊,並加上給定 ObjectContext的 。 |