InterceptionResult<TResult> Struct

Definition

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

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.

[System.Runtime.CompilerServices.IsReadOnly]
public struct InterceptionResult<TResult>
public 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

Properties

HasResult

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

Result

The result to use.

The property can only be accessed if HasResult is true. The concept here is the same as Value and HasValue

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