Share via


InterceptionResult<TResult> Struct

Definition

Represents a result from an IInterceptor such as an ISaveChangesInterceptor to allow suppression of the normal operation being intercepted.

[System.Runtime.CompilerServices.IsReadOnly]
public readonly struct InterceptionResult<TResult>
public readonly struct InterceptionResult<TResult>
[<System.Runtime.CompilerServices.IsReadOnly>]
type InterceptionResult<'Result> = struct
type InterceptionResult<'Result> = struct
Public Structure InterceptionResult(Of TResult)

Type Parameters

TResult

The new result to use.

Inheritance
InterceptionResult<TResult>
Attributes

Remarks

A value of this type is passed to all interceptor methods that are called before the operation being intercepted is executed. Typically the interceptor should return the value passed in. However, creating a result with SuppressWithResult(TResult) causes the operation being intercepted to be suppressed; that is, the operation is not executed. The value in the result is then used as a substitute return value for the operation that was suppressed.

See EF Core interceptors for more information and examples.

Properties

HasResult

If true, then interception is suppressed, and Result contains the result to use.

Result

The result to use.

Methods

SuppressWithResult(TResult)

Creates a new InterceptionResult<TResult> instance indicating that execution should be suppressed and the given result should be used instead.

Applies to