Table of Contents

Interface IResettableService

Namespace
Microsoft.EntityFrameworkCore.Infrastructure
Assembly
Microsoft.EntityFrameworkCore.dll

This interface must be implemented by any service that needs to be reset between different uses of the same DbContext in different pools.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IResettableService

Remarks

The service lifetime is Scoped and multiple registrations are allowed. This means that each DbContext instance will use its own set of instances of this service. The implementations may depend on other services registered with any lifetime. The implementations do not need to be thread-safe.

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

Methods

ResetState()

Resets the service so that it can be used from the pool.

void ResetState()

ResetStateAsync(CancellationToken)

Resets the service so that it can be used from the pool.

Task ResetStateAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

OperationCanceledException

If the CancellationToken is canceled.