DbCommandInterceptor.CommandCreating メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
EF が CreateCommand()を呼び出す直前に呼び出されます。
public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> CommandCreating(Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> result);
abstract member CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
override this.CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
Public Overridable Function CommandCreating (eventData As CommandCorrelatedEventData, result As InterceptionResult(Of DbCommand)) As InterceptionResult(Of DbCommand)
パラメーター
- eventData
- CommandCorrelatedEventData
コマンドと実行に関するコンテキスト情報。
- result
- InterceptionResult<DbCommand>
現在の結果 (存在する場合) を表します。
以前のインターセプターがSuppressWithResult(TResult)を呼び出して実行を抑制した場合、この値はtrueに設定HasResult。
通常、この値は、このメソッドの実装の戻り値として使用されます。
戻り値
HasResultが false の場合、EF は通常どおり続行されます。
HasResultが true の場合、EF は実行しようとしている操作を抑制し、代わりに Result を使用します。
結果を変更しようとしていないインターセプターに対するこのメソッドの通常の実装は、渡された result 値を返すことです。