Delen via


IDbContextTransactionManager Interface

Definition

Creates and manages the current transaction.

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

public interface IDbContextTransactionManager
public interface IDbContextTransactionManager : Microsoft.EntityFrameworkCore.Infrastructure.IResettableService
type IDbContextTransactionManager = interface
type IDbContextTransactionManager = interface
    interface IResettableService
Public Interface IDbContextTransactionManager
Public Interface IDbContextTransactionManager
Implements IResettableService
Derived
Implements

Remarks

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

See Implementation of database providers and extensions and Transactions in EF Core for more information and examples.

Properties

CurrentTransaction

Gets the current transaction.

Methods

BeginTransaction()

Begins a new transaction.

BeginTransactionAsync(CancellationToken)

Asynchronously begins a new transaction.

CommitTransaction()

Commits all changes made to the database in the current transaction.

CommitTransactionAsync(CancellationToken)

Commits all changes made to the database in the current transaction.

ResetState()

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

(Inherited from IResettableService)
ResetStateAsync(CancellationToken)

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

(Inherited from IResettableService)
RollbackTransaction()

Discards all changes made to the database in the current transaction.

RollbackTransactionAsync(CancellationToken)

Discards all changes made to the database in the current transaction.

Applies to