共用方式為


EntityCommand 類別

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

類別,表示概念層的命令

繼承階層

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Data.Common.DbCommand
        System.Data.Entity.Core.EntityClient.EntityCommand

命名空間:  System.Data.Entity.Core.EntityClient
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Public Class EntityCommand _
    Inherits DbCommand
'用途
Dim instance As EntityCommand
public class EntityCommand : DbCommand
public ref class EntityCommand : public DbCommand
type EntityCommand =  
    class 
        inherit DbCommand 
    end
public class EntityCommand extends DbCommand

EntityCommand 類型會公開下列成員。

建構函式

  名稱 描述
公用方法 EntityCommand() 使用指定的值,初始化 EntityCommand 類別的新執行個體。
公用方法 EntityCommand(String) 使用指定的陳述式,初始化 EntityCommand 類別的新執行個體。
公用方法 EntityCommand(String, EntityConnection) 使用指定的陳述式和連接,初始化 EntityCommand 類別的新執行個體。
公用方法 EntityCommand(String, EntityConnection, EntityTransaction) 使用指定的陳述式、連接和交易,初始化 EntityCommand 類別的新執行個體。
公用方法 EntityCommand(String, EntityConnection, IDbDependencyResolver) 使用給定的 eSQL 陳述式和要使用的連接物件,建構 EntityCommand 物件

靠上

屬性

  名稱 描述
受保護的屬性 CanRaiseEvents (繼承自 Component)。
公用屬性 CommandText 取得或設定 Entity SQL 陳述式 (Statement),此陳述式會指定要執行的命令或預存程序 (Stored Procedure)。 (覆寫 DbCommand.CommandText。)
公用屬性 CommandTimeout 取得或設定在逾時之前要等待的時間。 (覆寫 DbCommand.CommandTimeout。)
公用屬性 CommandTree 取得或設定要執行的命令樹,只能設定命令樹或命令文字中的其中一個,無法設定兩者。
公用屬性 CommandType 取得或設定值,此值表示如何解譯 CommandText 屬性。 (覆寫 DbCommand.CommandType。)
公用屬性 Connection 取得或設定 EntityCommand 所使用的 EntityConnection
公用屬性 Container (繼承自 Component)。
受保護的屬性 DbConnection 用於執行命令的連接物件 (覆寫 DbCommand.DbConnection。)
受保護的屬性 DbParameterCollection 此命令的參數集合 (覆寫 DbCommand.DbParameterCollection。)
受保護的屬性 DbTransaction 此命令執行所在的交易 (覆寫 DbCommand.DbTransaction。)
受保護的屬性 DesignMode (繼承自 Component)。
公用屬性 DesignTimeVisible 取得或設定值,此值表示在 Windows Form 設計工具控制項中是否應該看得到命令物件。 (覆寫 DbCommand.DesignTimeVisible。)
公用屬性 EnablePlanCaching 取得或設定值,指出查詢計畫快取是否已啟用。
受保護的屬性 Events (繼承自 Component)。
公用屬性 Parameters 取得 Entity SQL 陳述式或預存程序的參數。
公用屬性 Site (繼承自 Component)。
公用屬性 Transaction 取得或設定 SqlCommand 執行所在的交易。
公用屬性 UpdatedRowSource 取得或設定命令結果套用至要更新之資料列的方式。 (覆寫 DbCommand.UpdatedRowSource。)

靠上

方法

  名稱 描述
公用方法 Cancel 取消執行 EntityCommand。 (覆寫 DbCommand.Cancel()。)
受保護的方法 CreateDbParameter 建立並傳回新參數物件,代表 eSQL 陳述式中的參數 (覆寫 DbCommand.CreateDbParameter()。)
公用方法 CreateObjRef 安全性關鍵。 (繼承自 MarshalByRefObject)。
公用方法 CreateParameter 建立 EntityParameter 物件的新執行個體。
公用方法 Dispose() (繼承自 Component)。
受保護的方法 Dispose(Boolean) (繼承自 Component)。
公用方法 Equals (繼承自 Object)。
受保護的方法 ExecuteDbDataReader 執行命令並傳回讀取結果的資料讀取器 (覆寫 DbCommand.ExecuteDbDataReader(CommandBehavior)。)
受保護的方法 ExecuteDbDataReaderAsync 非同步執行命令並傳回讀取結果的資料讀取器 (覆寫 DbCommandExecuteDbDataReaderAsync(CommandBehavior, CancellationToken)。)
公用方法 ExecuteNonQuery 執行目前的命令。 (覆寫 DbCommand.ExecuteNonQuery()。)
公用方法 ExecuteNonQueryAsync (繼承自 DbCommand)。
公用方法 ExecuteNonQueryAsync(CancellationToken) 非同步執行命令並捨棄命令傳回的任何結果 (覆寫 DbCommandExecuteNonQueryAsync(CancellationToken)。)
公用方法 ExecuteReader() 執行命令並傳回資料讀取器。
公用方法 ExecuteReader(CommandBehavior) CommandText 編譯成命令樹,並將其傳遞至基礎存放區提供者來執行,然後使用指定的 CommandBehavior,從產生的結果集中建置 EntityDataReader
公用方法 ExecuteReaderAsync() 非同步執行命令並傳回讀取結果的資料讀取器。只能在 CommandType.CommandText 上呼叫 (否則,請使用標準 Execute* 方法)
公用方法 ExecuteReaderAsync(CommandBehavior) 非同步執行命令並傳回讀取結果的資料讀取器。只能在 CommandType.CommandText 上呼叫 (否則,請使用標準 Execute* 方法)
公用方法 ExecuteReaderAsync(CancellationToken) 非同步執行命令並傳回讀取結果的資料讀取器。只能在 CommandType.CommandText 上呼叫 (否則,請使用標準 Execute* 方法)
公用方法 ExecuteReaderAsync(CommandBehavior, CancellationToken) 非同步執行命令並傳回讀取結果的資料讀取器。只能在 CommandType.CommandText 上呼叫 (否則,請使用標準 Execute* 方法)
公用方法 ExecuteScalar 執行命令,並傳回結果集中第一個資料列的第一個資料行。會忽略其他的資料行或資料列。 (覆寫 DbCommand.ExecuteScalar()。)
公用方法 ExecuteScalarAsync (繼承自 DbCommand)。
公用方法 ExecuteScalarAsync(CancellationToken) (繼承自 DbCommand)。
受保護的方法 Finalize (繼承自 Component)。
公用方法 GetHashCode (繼承自 Object)。
公用方法 GetLifetimeService 安全性關鍵。 (繼承自 MarshalByRefObject)。
受保護的方法 GetService (繼承自 Component)。
公用方法 GetType (繼承自 Object)。
公用方法 InitializeLifetimeService 安全性關鍵。 (繼承自 MarshalByRefObject)。
受保護的方法 MemberwiseClone() (繼承自 Object)。
受保護的方法 MemberwiseClone(Boolean) (繼承自 MarshalByRefObject)。
公用方法 Prepare 編譯實體層級命令,並建立命令的備製版本。 (覆寫 DbCommand.Prepare()。)
公用方法 ToString (繼承自 Component)。
公用方法 ToTraceString 編譯實體層級命令並傳回存放區命令文字。

靠上

事件

  名稱 描述
公用事件 Disposed (繼承自 Component)。

靠上

明確介面實作

  名稱 描述
明確介面實作私用屬性 IDbCommand.Connection (繼承自 DbCommand)。
明確介面實作私用方法 IDbCommand.CreateParameter (繼承自 DbCommand)。
明確介面實作私用方法 IDbCommand.ExecuteReader() (繼承自 DbCommand)。
明確介面實作私用方法 IDbCommand.ExecuteReader(CommandBehavior) (繼承自 DbCommand)。
明確介面實作私用屬性 IDbCommand.Parameters (繼承自 DbCommand)。
明確介面實作私用屬性 IDbCommand.Transaction (繼承自 DbCommand)。

靠上

執行緒安全

這個類型的任何 Public static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。並非所有的執行個體成員都是安全執行緒。

請參閱

參考

System.Data.Entity.Core.EntityClient 命名空間