EntityCommand 类

定义

表示概念层的命令。Represents a command for the conceptual layer.

public ref class EntityCommand sealed : System::Data::Common::DbCommand
public sealed class EntityCommand : System.Data.Common.DbCommand
type EntityCommand = class
    inherit DbCommand
Public NotInheritable Class EntityCommand
Inherits DbCommand
继承

构造函数

EntityCommand()

使用指定的值初始化 EntityCommand 类的新实例。Initializes a new instance of the EntityCommand class using the specified values.

EntityCommand(String)

使用指定的语句初始化 EntityCommand 类的新实例。Initializes a new instance of the EntityCommand class with the specified statement.

EntityCommand(String, EntityConnection)

用指定的语句和连接初始化 EntityCommand 类的新实例。Initializes a new instance of the EntityCommand class with the specified statement and connection.

EntityCommand(String, EntityConnection, EntityTransaction)

用指定的语句,连接和事务初始化 EntityCommand 类的新实例。Initializes a new instance of the EntityCommand class with the specified statement, connection and transaction.

属性

CanRaiseEvents

获取一个指示组件是否可以引发事件的值。Gets a value indicating whether the component can raise an event.

(继承自 Component)
CommandText

获取或设置指定要执行的命令或存储过程的 Entity SQL 语句。Gets or sets an Entity SQL statement that specifies a command or stored procedure to execute.

CommandTimeout

获取或设置超时前要等待的时间长度。Gets or sets the amount of time to wait before timing out.

CommandTree

获取或设置要执行的命令树;只能设置命令树或命令文本其中之一,而不能同时设置二者。Gets or sets the command tree to execute; only one of the command tree or the command text can be set, not both.

CommandType

获取或设置一个值,该值指示如何解释 CommandText 属性。Gets or sets a value that indicates how the CommandText property is to be interpreted.

Connection

获取或设置由 EntityConnection 使用的 EntityCommandGets or sets the EntityConnection used by the EntityCommand.

Container

获取包含 IContainerComponentGets the IContainer that contains the Component.

(继承自 Component)
DbConnection

当在派生类中重写时,获取或设置此 DbCommand 使用的 DbConnectionWhen overridden in a derived class, gets or sets the DbConnection used by this DbCommand.

(继承自 DbCommand)
DbParameterCollection

在派生类中重写时,获取 DbParameter 对象的集合。When overridden in a derived class, gets the collection of DbParameter objects.

(继承自 DbCommand)
DbTransaction

当在派生类中重写时,获取或设置执行 DbCommand 对象时所在的 DbTransactionWhen overridden in a derived class, gets or sets the DbTransaction within which this DbCommand object executes.

(继承自 DbCommand)
DesignMode

获取一个值,用以指示 Component 当前是否处于设计模式。Gets a value that indicates whether the Component is currently in design mode.

(继承自 Component)
DesignTimeVisible

获取或设置一个值,该值指示命令对象在 Windows 窗体设计器控件中是否应该可见。Gets or sets a value that indicates whether the command object should be visible in a Windows Form Designer control.

EnablePlanCaching

获取或设置一个值,该值指示查询计划缓存是否启用。Gets or sets a value that indicates whether the query plan caching is enabled.

Events

获取附加到此 Component 的事件处理程序的列表。Gets the list of event handlers that are attached to this Component.

(继承自 Component)
Parameters

获取 Entity SQL 语句的参数或存储过程。Gets the parameters of the Entity SQL statement or stored procedure.

Site

获取或设置 ComponentISiteGets or sets the ISite of the Component.

(继承自 Component)
Transaction

获取或设置 SqlCommand 在其中执行的事务。Gets or sets the transaction within which the SqlCommand executes.

UpdatedRowSource

获取或设置如何向正在更新的行应用命令结果的方式。Gets or sets how command results are applied to rows being updated.

方法

Cancel()

取消执行 EntityCommandCancels the execution of an EntityCommand.

CreateDbParameter()

在派生类中重写时,创建 DbParameter 对象的新实例。When overridden in a derived class, creates a new instance of a DbParameter object.

(继承自 DbCommand)
CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
CreateParameter()

创建 EntityParameter 对象的新实例。Creates a new instance of an EntityParameter object.

Dispose()

执行与释放或重置非托管资源关联的应用程序定义的任务。Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(继承自 DbCommand)
Dispose(Boolean)

释放由 DbCommand 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the DbCommand and optionally releases the managed resources.

(继承自 DbCommand)
DisposeAsync()

异步处置命令对象。Asynchronously diposes the command object.

(继承自 DbCommand)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
ExecuteDbDataReader(CommandBehavior)

当在派生类中重写时,针对连接执行命令文本。When overridden in a derived class, executes the command text against the connection.

(继承自 DbCommand)
ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken)

提供程序应执行该方法对 ExecuteReader 重载提供非默认的实现。Providers should implement this method to provide a non-default implementation for ExecuteReader overloads.

默认实现调用同步 ExecuteReader() 方法并返回已完成任务,以便阻止调用线程。The default implementation invokes the synchronous ExecuteReader() method and returns a completed task, blocking the calling thread. 如果传递到已取消的取消标记,则默认实现将返回已取消的任务。The default implementation will return a cancelled task if passed an already cancelled cancellation token. ExecuteReader 引发的异常将通过返回的任务异常属性传递。Exceptions thrown by ExecuteReader will be communicated via the returned Task Exception property.

该方法可用于请求操作之前接受取消标记。This method accepts a cancellation token that can be used to request the operation to be cancelled early. 实现可能会忽略该请求。Implementations may ignore this request.

(继承自 DbCommand)
ExecuteNonQuery()

执行当前命令。Executes the current command.

ExecuteNonQueryAsync()

ExecuteNonQuery()的异步版本,针对一个连接对象执行一个 SQL 声明。An asynchronous version of ExecuteNonQuery(), which executes a SQL statement against a connection object.

通过 CancellationToken.None 调用 ExecuteNonQueryAsync(CancellationToken)Invokes ExecuteNonQueryAsync(CancellationToken) with CancellationToken.None.

(继承自 DbCommand)
ExecuteNonQueryAsync(CancellationToken)

这是 ExecuteNonQuery() 的异步版本。This is the asynchronous version of ExecuteNonQuery(). 提供程序应使用合适的实现进行重写。Providers should override with an appropriate implementation. 可选择性忽略取消标记。The cancellation token may optionally be ignored.

默认实现调用同步 ExecuteNonQuery() 方法并返回已完成任务,以便阻止调用线程。The default implementation invokes the synchronous ExecuteNonQuery() method and returns a completed task, blocking the calling thread. 如果传递到已取消的取消标记,则默认实现将返回已取消的任务。The default implementation will return a cancelled task if passed an already cancelled cancellation token. ExecuteNonQuery() 引发的异常将通过任务异常属性传递。Exceptions thrown by ExecuteNonQuery() will be communicated via the returned Task Exception property.

在返回的任务完成前,不要调用 DbCommand 对象的其他方法和属性。Do not invoke other methods and properties of the DbCommand object until the returned Task is complete.

(继承自 DbCommand)
ExecuteReader()

执行命令并返回一个数据读取器。Executes the command and returns a data reader.

ExecuteReader(CommandBehavior)

CommandText 编译到命令树,并将其传递到基础存储区提供程序以执行,然后在使用指定的 EntityDataReader 生成的结果集外生成一个 CommandBehaviorCompiles the CommandText into a command tree and passes it to the underlying store provider for execution, then builds an EntityDataReader out of the produced result set using the specified CommandBehavior.

ExecuteReaderAsync()

ExecuteReader 的异步版本,针对 CommandTextConnection 执行 DbDataReaderAn asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader.

通过 CancellationToken.None 调用 ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken)Invokes ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) with CancellationToken.None.

(继承自 DbCommand)
ExecuteReaderAsync(CancellationToken)

ExecuteReader 的异步版本,针对 CommandTextConnection 执行 DbDataReaderAn asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader. 此方法传播有关应取消操作的通知。This method propagates a notification that operations should be canceled.

调用 ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).Invokes ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).

(继承自 DbCommand)
ExecuteReaderAsync(CommandBehavior)

ExecuteReader 的异步版本,针对 CommandTextConnection 执行 DbDataReaderAn asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader.

调用 ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).Invokes ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).

(继承自 DbCommand)
ExecuteReaderAsync(CommandBehavior, CancellationToken)

调用 ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).Invokes ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).

(继承自 DbCommand)
ExecuteScalar()

执行命令,并返回结果集中第一行的第一列。Executes the command, and returns the first column of the first row in the result set. 忽略其他列或行。Additional columns or rows are ignored.

ExecuteScalarAsync()

ExecuteScalar() 的异步版本,执行查询,并将查询返回的结果集中第一行的第一列返回。An asynchronous version of ExecuteScalar(), which executes the query and returns the first column of the first row in the result set returned by the query. 所有其他的列和行将被忽略。All other columns and rows are ignored.

通过 CancellationToken.None 调用 ExecuteScalarAsync(CancellationToken)Invokes ExecuteScalarAsync(CancellationToken) with CancellationToken.None.

(继承自 DbCommand)
ExecuteScalarAsync(CancellationToken)

这是 ExecuteScalar() 的异步版本。This is the asynchronous version of ExecuteScalar(). 提供程序应使用合适的实现进行重写。Providers should override with an appropriate implementation. 可选择性忽略取消标记。The cancellation token may optionally be ignored.

默认实现调用同步 ExecuteScalar() 方法并返回已完成任务,以便阻止调用线程。The default implementation invokes the synchronous ExecuteScalar() method and returns a completed task, blocking the calling thread. 如果传递到已取消的取消标记,则默认实现将返回已取消的任务。The default implementation will return a cancelled task if passed an already cancelled cancellation token. ExecuteScalar 引发的异常将通过返回的任务异常属性传递。Exceptions thrown by ExecuteScalar will be communicated via the returned Task Exception property.

在返回的任务完成前,不要调用 DbCommand 对象的其他方法和属性。Do not invoke other methods and properties of the DbCommand object until the returned Task is complete.

(继承自 DbCommand)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetService(Type)

返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。Returns an object that represents a service provided by the Component or by its Container.

(继承自 Component)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
Prepare()

编译实体级别的命令并创建该命令的准备版本。Compiles the entity-level command and creates a prepared version of the command.

PrepareAsync(CancellationToken)

在数据源上异步创建准备就绪(或已编译)的命令版本。Asynchronously creates a prepared (or compiled) version of the command on the data source.

(继承自 DbCommand)
ToString()

返回包含 Component 的名称的 String(如果有)。Returns a String containing the name of the Component, if any. 不应重写此方法。This method should not be overridden.

(继承自 Component)
ToTraceString()

编译实体级别的命令并返回存储命令文本。Compiles the entity-level command and returns the store command text.

事件

Disposed

在通过调用 Dispose() 方法释放组件时发生。Occurs when the component is disposed by a call to the Dispose() method.

(继承自 Component)

显式接口实现

IDbCommand.Connection

获取或设置 IDbCommand 的此实例使用的 IDbConnectionGets or sets the IDbConnection used by this instance of the IDbCommand.

(继承自 DbCommand)
IDbCommand.CreateParameter()

创建 IDbDataParameter 对象的新实例。Creates a new instance of an IDbDataParameter object.

(继承自 DbCommand)
IDbCommand.ExecuteReader()

Connection 执行 CommandText 并生成 IDataReaderExecutes the CommandText against the Connection and builds an IDataReader.

(继承自 DbCommand)
IDbCommand.ExecuteReader(CommandBehavior)

Connection 执行 CommandText,并使用 CommandBehavior 值之一生成 IDataReaderExecutes the CommandText against the Connection, and builds an IDataReader using one of the CommandBehavior values.

(继承自 DbCommand)
IDbCommand.Parameters

获取 IDataParameterCollectionGets the IDataParameterCollection.

(继承自 DbCommand)
IDbCommand.Transaction

获取或设置将在其中执行此 DbCommand 对象的 DbTransactionGets or sets the DbTransaction within which this DbCommand object executes.

(继承自 DbCommand)

适用于