DbCommandInterceptor.ScalarExecuting 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在 EF 打算调用之前调用 ExecuteScalar()。
public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object> ScalarExecuting(System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object> result);
abstract member ScalarExecuting : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>
override this.ScalarExecuting : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>
Public Overridable Function ScalarExecuting (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Object)) As InterceptionResult(Of Object)
参数
- command
- DbCommand
命令。
- eventData
- CommandEventData
有关命令和执行的上下文信息。
- result
- InterceptionResult<Object>
表示当前结果(如果存在)。
如果某些以前的拦截器通过调用
返回
如果 HasResult 为 false,EF 将照常继续。
如果 HasResult 为 true,则 EF 将禁止执行并改 Result 用该操作。
未尝试更改结果的任何侦听器的此方法的正常实现是返回 result 传入的值,通常使用 FromResult<TResult>(TResult)