IDbCommandInterceptor.CommandCreated(CommandEndEventData, DbCommand) 方法

定义

在 EF 调用 后立即调用 CreateCommand()

public System.Data.Common.DbCommand CommandCreated (Microsoft.EntityFrameworkCore.Diagnostics.CommandEndEventData eventData, System.Data.Common.DbCommand result);
public virtual System.Data.Common.DbCommand CommandCreated (Microsoft.EntityFrameworkCore.Diagnostics.CommandEndEventData eventData, System.Data.Common.DbCommand result);
abstract member CommandCreated : Microsoft.EntityFrameworkCore.Diagnostics.CommandEndEventData * System.Data.Common.DbCommand -> System.Data.Common.DbCommand
abstract member CommandCreated : Microsoft.EntityFrameworkCore.Diagnostics.CommandEndEventData * System.Data.Common.DbCommand -> System.Data.Common.DbCommand
override this.CommandCreated : Microsoft.EntityFrameworkCore.Diagnostics.CommandEndEventData * System.Data.Common.DbCommand -> System.Data.Common.DbCommand
Public Function CommandCreated (eventData As CommandEndEventData, result As DbCommand) As DbCommand
Public Overridable Function CommandCreated (eventData As CommandEndEventData, result As DbCommand) As DbCommand

参数

eventData
CommandEndEventData

有关命令和执行的上下文信息。

result
DbCommand

调用 CreateCommand()的结果。 此值通常用作此方法实现的返回值。

返回

EF 将使用的结果。 对于未尝试更改结果的任何侦听器,此方法的实现是返回 result 传入的值。

注解

如果侦听器禁止在 中创建 CommandCreating(CommandCorrelatedEventData, InterceptionResult<DbCommand>)命令,则仍会调用此方法。 在本例中, result 是 返回 CommandCreating(CommandCorrelatedEventData, InterceptionResult<DbCommand>)的结果。

适用于