Table of Contents

Interface IExceptionDetector

Namespace
Microsoft.EntityFrameworkCore.Storage
Assembly
Microsoft.EntityFrameworkCore.dll

Used by EF internal code and database providers to detect various types of exceptions.

public interface IExceptionDetector

Remarks

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

See Implementation of database providers and extensions for more information and examples.

Methods

IsCancellation(Exception, CancellationToken)

Returns whether the provided exception represents a cancellation event for the current provider.

bool IsCancellation(Exception exception, CancellationToken cancellationToken = default)

Parameters

exception Exception

The exception to be checked for cancellation.

cancellationToken CancellationToken

If exception is insufficient for identifying a cancellation, this is the cancellation token passed to the asynchronous operation; it can be checked instead as a fallback mechanism.

Returns

bool